From 1da363f9b2a988d0f73bf5dab67580aa3c0510f3 Mon Sep 17 00:00:00 2001 From: greg stone Date: Sat, 25 Feb 2023 23:06:02 +0000 Subject: [PATCH] adding target to dial options. --- pkg/rpc/client.go | 2 +- pkg/rpc/dialer.go | 2 +- pkg/rpc/dialer_options.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/rpc/client.go b/pkg/rpc/client.go index a37bb60c..83eb8a2c 100644 --- a/pkg/rpc/client.go +++ b/pkg/rpc/client.go @@ -23,7 +23,7 @@ func getNetworkInstance(opts *dialOptions) (net *netstack.Net, err error) { deviceConf := "" + "public_key=" + opts.peerPubKey.HexString() + "\n" + - "endpoint=0.0.0.0:18222" + "\n" + + "endpoint=" + opts.endpoint + "\n" + "allowed_ip=" + rpcEndpointIp + "/32\n" + "persistent_keepalive_interval=" + strconv.Itoa(opts.keepAliveInterval) + "\n" diff --git a/pkg/rpc/dialer.go b/pkg/rpc/dialer.go index 8a9c4f23..63600b2e 100644 --- a/pkg/rpc/dialer.go +++ b/pkg/rpc/dialer.go @@ -28,7 +28,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * return nil, errors.New("Unsupported protocol. Only unix:// or noise://") } - dialOpts := &dialOptions{peerRPCIP: "192.168.37.2", mtu: 1420} + dialOpts := &dialOptions{peerRPCIP: "192.168.37.2", mtu: 1420, endpoint: strings.TrimPrefix(target, "noise://")} for _, opt := range opts { opt.apply(dialOpts) diff --git a/pkg/rpc/dialer_options.go b/pkg/rpc/dialer_options.go index 0c60c5a7..9b38a9cf 100644 --- a/pkg/rpc/dialer_options.go +++ b/pkg/rpc/dialer_options.go @@ -3,6 +3,7 @@ package rpc // dialOptions configure a Dial call. dialOptions are set by the DialOption // values passed to Dial. type dialOptions struct { + endpoint string key RPCPrivateKey peerPubKey RPCPublicKey peerRPCIP string