adding target to dial options.
This commit is contained in:
@@ -23,7 +23,7 @@ func getNetworkInstance(opts *dialOptions) (net *netstack.Net, err error) {
|
|||||||
|
|
||||||
deviceConf := "" +
|
deviceConf := "" +
|
||||||
"public_key=" + opts.peerPubKey.HexString() + "\n" +
|
"public_key=" + opts.peerPubKey.HexString() + "\n" +
|
||||||
"endpoint=0.0.0.0:18222" + "\n" +
|
"endpoint=" + opts.endpoint + "\n" +
|
||||||
"allowed_ip=" + rpcEndpointIp + "/32\n" +
|
"allowed_ip=" + rpcEndpointIp + "/32\n" +
|
||||||
"persistent_keepalive_interval=" + strconv.Itoa(opts.keepAliveInterval) + "\n"
|
"persistent_keepalive_interval=" + strconv.Itoa(opts.keepAliveInterval) + "\n"
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
|
|||||||
return nil, errors.New("Unsupported protocol. Only unix:// or noise://")
|
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 {
|
for _, opt := range opts {
|
||||||
opt.apply(dialOpts)
|
opt.apply(dialOpts)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package rpc
|
|||||||
// dialOptions configure a Dial call. dialOptions are set by the DialOption
|
// dialOptions configure a Dial call. dialOptions are set by the DialOption
|
||||||
// values passed to Dial.
|
// values passed to Dial.
|
||||||
type dialOptions struct {
|
type dialOptions struct {
|
||||||
|
endpoint string
|
||||||
key RPCPrivateKey
|
key RPCPrivateKey
|
||||||
peerPubKey RPCPublicKey
|
peerPubKey RPCPublicKey
|
||||||
peerRPCIP string
|
peerRPCIP string
|
||||||
|
|||||||
Reference in New Issue
Block a user