Merge pull request #762 from micro/net-address

Set node address to tunnel address
This commit is contained in:
Asim Aslam 2019-09-17 15:44:13 +01:00 committed by GitHub
commit a811b4be3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -639,7 +639,7 @@ func (n *network) advertise(client transport.Client, advertChan <-chan *router.A
route := &pbRtr.Route{
Service: event.Route.Service,
Address: event.Route.Address,
Gateway: n.options.Address,
Gateway: n.node.address,
Network: event.Route.Network,
Router: event.Route.Router,
Link: DefaultLink,
@ -689,6 +689,9 @@ func (n *network) Connect() error {
return err
}
// set our internal node address
n.node.address = n.Tunnel.Address()
// initialize the tunnel to resolved nodes
n.Tunnel.Init(
tunnel.Nodes(nodes...),
@ -755,8 +758,8 @@ func (n *network) Connect() error {
// we initialize all other node resources first
msg := &pbNet.Connect{
Node: &pbNet.Node{
Id: n.options.Id,
Address: n.options.Address,
Id: n.node.id,
Address: n.node.address,
},
}
if err := n.sendMsg("connect", msg, NetworkChannel); err != nil {
@ -826,8 +829,8 @@ func (n *network) Close() error {
msg := &pbNet.Close{
Node: &pbNet.Node{
Id: n.options.Id,
Address: n.options.Address,
Id: n.node.id,
Address: n.node.address,
},
}
if err := n.sendMsg("close", msg, NetworkChannel); err != nil {