From 35b8fb90a9cb836ee228fed20720b7ade494532f Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 27 Feb 2024 15:24:44 +0100 Subject: Client: Update to latest proxyguard API --- client/proxy.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'client') diff --git a/client/proxy.go b/client/proxy.go index c008f56..60bf980 100644 --- a/client/proxy.go +++ b/client/proxy.go @@ -24,20 +24,21 @@ func (pl *ProxyLogger) Log(msg string) { func (c *Client) StartProxyguard(ck *cookie.Cookie, listen string, tcpsp int, peer string, gotFD func(fd int), ready func()) error { var err error proxyguard.UpdateLogger(&ProxyLogger{}) - proxyguard.GotClientFD = gotFD - proxyguard.ClientProxyReady = func() { - // already connected - // no need to signal to the client that the proxy is ready - if c.InState(StateConnected) { - log.Logger.Debugf("proxyguard is ready again when the client was already connected") - return - } - log.Logger.Debugf("forwarding proxyguard ready callback to client") - ready() + + proxyc := proxyguard.Client{ + Listen: listen, + TCPSourcePort: tcpsp, + SetupSocket: func(fd int, _ []string) { + if gotFD != nil { + gotFD(fd) + } + // TODO: support peerips + }, + Ready: ready, } // we set peer IPs to nil here as proxyguard already does a DNS request for us - err = proxyguard.Client(ck.Context(), listen, tcpsp, peer, nil, -1) + err = proxyc.Tunnel(ck.Context(), peer, nil) if err != nil { return i18nerr.Wrap(err, "The VPN proxy exited") } -- cgit v1.2.3