mirror of https://github.com/v2ray/v2ray-core
simplify destination copy logic
parent
78d682e4d1
commit
e149782025
|
@ -62,11 +62,10 @@ func (v *Handler) ResolveIP(destination net.Destination) net.Destination {
|
||||||
}
|
}
|
||||||
|
|
||||||
ip := ips[dice.Roll(len(ips))]
|
ip := ips[dice.Roll(len(ips))]
|
||||||
var newDest net.Destination
|
newDest := net.Destination{
|
||||||
if destination.Network == net.Network_TCP {
|
Network: destination.Network,
|
||||||
newDest = net.TCPDestination(net.IPAddress(ip), destination.Port)
|
Address: net.IPAddress(ip),
|
||||||
} else {
|
Port: destination.Port,
|
||||||
newDest = net.UDPDestination(net.IPAddress(ip), destination.Port)
|
|
||||||
}
|
}
|
||||||
log.Trace(newError("changing destination from ", destination, " to ", newDest))
|
log.Trace(newError("changing destination from ", destination, " to ", newDest))
|
||||||
return newDest
|
return newDest
|
||||||
|
|
Loading…
Reference in New Issue