metropolis/cli/metroctl: use DialContext instead of Dial
Closes #387
Change-Id: I2d6e0589d84463e45ca83baa05197bf3b53b8d72
Reviewed-on: https://review.monogon.dev/c/monogon/+/4358
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/cli/metroctl/rpc.go b/metropolis/cli/metroctl/rpc.go
index b3a9819..2c3f163 100644
--- a/metropolis/cli/metroctl/rpc.go
+++ b/metropolis/cli/metroctl/rpc.go
@@ -94,8 +94,9 @@
return nil, fmt.Errorf("failed to create proxy dialer: %w", err)
}
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
- // TODO(q3k): handle context
- return dialer.Dial(network, addr)
+ // proxy.SOCKS5 returns a Dialer that implements the DialContext
+ // function, just doesn't exposes it.
+ return dialer.(proxy.ContextDialer).DialContext(ctx, network, addr)
}
}
return transport, nil