diff --git a/network/default.go b/network/default.go index 799bc643..ac50c901 100644 --- a/network/default.go +++ b/network/default.go @@ -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 {