From b9db4514e26907bc846564e71575e0bce45335c2 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 18 Jul 2018 16:21:40 +0200 Subject: [PATCH] allow partial override in freedom --- proxy/freedom/freedom.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 0b26437b6..8c958b309 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -70,10 +70,11 @@ func (h *Handler) Process(ctx context.Context, link *core.Link, dialer proxy.Dia destination, _ := proxy.TargetFromContext(ctx) if h.config.DestinationOverride != nil { server := h.config.DestinationOverride.Server - destination = net.Destination{ - Network: destination.Network, - Address: server.Address.AsAddress(), - Port: net.Port(server.Port), + if server.Address != nil { + destination.Address = server.Address.AsAddress() + } + if server.Port != 0 { + destination.Port = net.Port(server.Port) } } newError("opening connection to ", destination).WriteToLog(session.ExportIDToError(ctx))