Skip to content

Commit

Permalink
fix: avoid dialing/listening on dns addresses
Browse files Browse the repository at this point in the history
See #841
  • Loading branch information
Stebalien committed Apr 3, 2020
1 parent 75a10a8 commit e8ccc0b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion p2p/transport/quic/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,12 @@ func (t *transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tp
}, nil
}

// Don't use mafmt.QUIC as we don't want to dial DNS addresses. Just /ip{4,6}/udp/quic
var dialMatcher = mafmt.And(mafmt.IP, mafmt.Base(ma.P_UDP), mafmt.Base(ma.P_QUIC))

// CanDial determines if we can dial to an address
func (t *transport) CanDial(addr ma.Multiaddr) bool {
return mafmt.QUIC.Matches(addr)
return dialMatcher.Matches(addr)
}

// Listen listens for new QUIC connections on the passed multiaddr.
Expand Down

0 comments on commit e8ccc0b

Please sign in to comment.