ソースを参照

simplify destination copy logic

Darien Raymond 8 年 前
コミット
e149782025
1 ファイル変更4 行追加5 行削除
  1. 4 5
      proxy/freedom/freedom.go

+ 4 - 5
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