mirror of https://github.com/v2ray/v2ray-core
Lazy initialization of UDP ports map
parent
2a4edde634
commit
365baa0c6a
4
point.go
4
point.go
|
@ -96,3 +96,7 @@ func (p *Point) DispatchToOutbound(packet v2net.Packet) InboundRay {
|
||||||
_ = och.Start(ray)
|
_ = och.Start(ray)
|
||||||
return ray
|
return ray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Point) DispatchToInbound(packet v2net.Packet) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
@ -68,12 +68,14 @@ func (m *portMap) popPort(token uint16) *net.UDPAddr {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ports = newPortMap()
|
ports *portMap
|
||||||
|
|
||||||
udpConn *net.UDPConn
|
udpConn *net.UDPConn
|
||||||
)
|
)
|
||||||
|
|
||||||
func (server *SocksServer) ListenUDP(port uint16) error {
|
func (server *SocksServer) ListenUDP(port uint16) error {
|
||||||
|
ports = newPortMap()
|
||||||
|
|
||||||
addr := &net.UDPAddr{
|
addr := &net.UDPAddr{
|
||||||
IP: net.IP{0, 0, 0, 0},
|
IP: net.IP{0, 0, 0, 0},
|
||||||
Port: int(port),
|
Port: int(port),
|
||||||
|
|
Loading…
Reference in New Issue