Browse Source

swarm: mark dialing WebTransport addresses as expensive (#1650)

pull/1652/head
Marten Seemann 2 years ago
committed by GitHub
parent
commit
3d351e4ed3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      p2p/net/swarm/swarm_dial.go

7
p2p/net/swarm/swarm_dial.go

@ -425,9 +425,10 @@ func isFdConsumingAddr(addr ma.Multiaddr) bool {
}
func isExpensiveAddr(addr ma.Multiaddr) bool {
_, err1 := addr.ValueForProtocol(ma.P_WS)
_, err2 := addr.ValueForProtocol(ma.P_WSS)
return err1 == nil || err2 == nil
_, wsErr := addr.ValueForProtocol(ma.P_WS)
_, wssErr := addr.ValueForProtocol(ma.P_WSS)
_, wtErr := addr.ValueForProtocol(ma.P_WEBTRANSPORT)
return wsErr == nil || wssErr == nil || wtErr == nil
}
func isRelayAddr(addr ma.Multiaddr) bool {

Loading…
Cancel
Save