Skip to content

Commit

Permalink
mdns: always use interface addresses
Browse files Browse the repository at this point in the history
We don't want to use the transformed/munged host addresses for local
announcements. Ideally, we'd take a more scientific approach to this (i.e.,
"host, please give me addresses relative to X") but we can't do that yet.
  • Loading branch information
Stebalien committed Jul 16, 2019
1 parent 15764f7 commit 554a8e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ github.com/libp2p/go-libp2p-circuit v0.1.0 h1:eniLL3Y9aq/sryfyV1IAHj5rlvuyj3b7iz
github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8=
github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco=
github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I=
github.com/libp2p/go-libp2p-core v0.0.6 h1:SsYhfWJ47vLP1Rd9/0hqEm/W/PlFbC/3YLZyLCcvo1w=
github.com/libp2p/go-libp2p-core v0.0.6/go.mod h1:0d9xmaYAVY5qmbp/fcgxHT3ZJsLjYeYPMJAUKpaCHrE=
github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI=
github.com/libp2p/go-libp2p-discovery v0.1.0 h1:j+R6cokKcGbnZLf4kcNwpx6mDEUPF3N6SrqMymQhmvs=
Expand Down
6 changes: 5 additions & 1 deletion p2p/discovery/mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ type mdnsService struct {

func getDialableListenAddrs(ph host.Host) ([]*net.TCPAddr, error) {
var out []*net.TCPAddr
for _, addr := range ph.Addrs() {
addrs, err := ph.Network().InterfaceListenAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
na, err := manet.ToNetAddr(addr)
if err != nil {
continue
Expand Down

0 comments on commit 554a8e7

Please sign in to comment.