1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-05 16:55:27 -05:00

move port allocation to udp package

This commit is contained in:
Darien Raymond
2017-11-14 23:45:07 +01:00
parent 268d7264e8
commit a430e2065a
4 changed files with 22 additions and 15 deletions

View File

@@ -29,18 +29,6 @@ func pickPort() net.Port {
return net.Port(addr.Port)
}
func pickUDPPort() net.Port {
conn, err := net.ListenUDP("udp4", &net.UDPAddr{
IP: net.LocalHostIP.IP(),
Port: 0,
})
common.Must(err)
defer conn.Close()
addr := conn.LocalAddr().(*net.UDPAddr)
return net.Port(addr.Port)
}
func xor(b []byte) []byte {
r := make([]byte, len(b))
for i, v := range b {