Merge pull request #762 from micro/net-address
Set node address to tunnel address
This commit is contained in:
commit
a811b4be3d
@ -639,7 +639,7 @@ func (n *network) advertise(client transport.Client, advertChan <-chan *router.A
|
|||||||
route := &pbRtr.Route{
|
route := &pbRtr.Route{
|
||||||
Service: event.Route.Service,
|
Service: event.Route.Service,
|
||||||
Address: event.Route.Address,
|
Address: event.Route.Address,
|
||||||
Gateway: n.options.Address,
|
Gateway: n.node.address,
|
||||||
Network: event.Route.Network,
|
Network: event.Route.Network,
|
||||||
Router: event.Route.Router,
|
Router: event.Route.Router,
|
||||||
Link: DefaultLink,
|
Link: DefaultLink,
|
||||||
@ -689,6 +689,9 @@ func (n *network) Connect() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set our internal node address
|
||||||
|
n.node.address = n.Tunnel.Address()
|
||||||
|
|
||||||
// initialize the tunnel to resolved nodes
|
// initialize the tunnel to resolved nodes
|
||||||
n.Tunnel.Init(
|
n.Tunnel.Init(
|
||||||
tunnel.Nodes(nodes...),
|
tunnel.Nodes(nodes...),
|
||||||
@ -755,8 +758,8 @@ func (n *network) Connect() error {
|
|||||||
// we initialize all other node resources first
|
// we initialize all other node resources first
|
||||||
msg := &pbNet.Connect{
|
msg := &pbNet.Connect{
|
||||||
Node: &pbNet.Node{
|
Node: &pbNet.Node{
|
||||||
Id: n.options.Id,
|
Id: n.node.id,
|
||||||
Address: n.options.Address,
|
Address: n.node.address,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if err := n.sendMsg("connect", msg, NetworkChannel); err != nil {
|
if err := n.sendMsg("connect", msg, NetworkChannel); err != nil {
|
||||||
@ -826,8 +829,8 @@ func (n *network) Close() error {
|
|||||||
|
|
||||||
msg := &pbNet.Close{
|
msg := &pbNet.Close{
|
||||||
Node: &pbNet.Node{
|
Node: &pbNet.Node{
|
||||||
Id: n.options.Id,
|
Id: n.node.id,
|
||||||
Address: n.options.Address,
|
Address: n.node.address,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if err := n.sendMsg("close", msg, NetworkChannel); err != nil {
|
if err := n.sendMsg("close", msg, NetworkChannel); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user