From e149782025943d30124bdbdc905b60d9423296de Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 11 Sep 2017 22:03:26 +0200 Subject: [PATCH] simplify destination copy logic --- proxy/freedom/freedom.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 3b292b7e6..7df958b7d 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -62,11 +62,10 @@ func (v *Handler) ResolveIP(destination net.Destination) net.Destination { } ip := ips[dice.Roll(len(ips))] - var newDest net.Destination - if destination.Network == net.Network_TCP { - newDest = net.TCPDestination(net.IPAddress(ip), destination.Port) - } else { - newDest = net.UDPDestination(net.IPAddress(ip), destination.Port) + newDest := net.Destination{ + Network: destination.Network, + Address: net.IPAddress(ip), + Port: destination.Port, } log.Trace(newError("changing destination from ", destination, " to ", newDest)) return newDest