From ec95dca3e5cc5fb2ccc77c0d1c451270f03f8f1b Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 11 Dec 2018 10:17:50 +0100 Subject: [PATCH] force packet reader in freedom on UDP --- proxy/freedom/freedom.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 49d05d148..07b70b094 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -160,7 +160,13 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte responseDone := func() error { defer timer.SetTimeout(plcy.Timeouts.UplinkOnly) - if err := buf.Copy(buf.NewReader(conn), output, buf.UpdateActivity(timer)); err != nil { + var reader buf.Reader + if destination.Network == net.Network_TCP { + reader = buf.NewReader(conn) + } else { + reader = &buf.PacketReader{Reader: conn} + } + if err := buf.Copy(reader, output, buf.UpdateActivity(timer)); err != nil { return newError("failed to process response").Base(err) }