summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-27 15:24:44 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-27 15:24:44 +0100
commit35b8fb90a9cb836ee228fed20720b7ade494532f (patch)
treec3039a6d16dede3ac339ca04ed282112e5826a9a /client
parentcfed8b98cc5cf34193184b2614d0465494d1417f (diff)
Client: Update to latest proxyguard API
Diffstat (limited to 'client')
-rw-r--r--client/proxy.go23
1 files changed, 12 insertions, 11 deletions
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")
}