adding target to dial options.

This commit is contained in:
greg stone
2023-02-25 23:06:02 +00:00
parent a9b43ed961
commit 1da363f9b2
3 changed files with 3 additions and 2 deletions

View File

@@ -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"

View File

@@ -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)

View File

@@ -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