Merge pull request #816 from micro/net-advertise
Advertise your peer address as advertised address
This commit is contained in:
commit
d5658ab0b0
@ -93,11 +93,14 @@ func newNetwork(opts ...Option) Network {
|
|||||||
|
|
||||||
// set the address to advertise
|
// set the address to advertise
|
||||||
var advertise string
|
var advertise string
|
||||||
|
var peerAddress string
|
||||||
|
|
||||||
if len(options.Advertise) > 0 {
|
if len(options.Advertise) > 0 {
|
||||||
advertise = options.Advertise
|
advertise = options.Advertise
|
||||||
|
peerAddress = options.Advertise
|
||||||
} else {
|
} else {
|
||||||
advertise = options.Address
|
advertise = options.Address
|
||||||
|
peerAddress = address
|
||||||
}
|
}
|
||||||
|
|
||||||
// server is network server
|
// server is network server
|
||||||
@ -122,7 +125,7 @@ func newNetwork(opts ...Option) Network {
|
|||||||
network := &network{
|
network := &network{
|
||||||
node: &node{
|
node: &node{
|
||||||
id: options.Id,
|
id: options.Id,
|
||||||
address: address,
|
address: peerAddress,
|
||||||
peers: make(map[string]*node),
|
peers: make(map[string]*node),
|
||||||
},
|
},
|
||||||
options: options,
|
options: options,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user