Commit df0ab8b9 authored by vyzo's avatar vyzo

make addr utility funcs standalone and not exported

parent be3e9404
......@@ -621,10 +621,10 @@ func (s *Swarm) nonProxyAddr(addr ma.Multiaddr) bool {
// UDP > TCP
func (s *Swarm) rankAddrs(addrs []ma.Multiaddr) []ma.Multiaddr {
addrTier := func(a ma.Multiaddr) (tier int) {
if s.IsRelayAddr(a) {
if isRelayAddr(a) {
tier |= 0b1000
}
if s.IsExpensiveAddr(a) {
if isExpensiveAddr(a) {
tier |= 0b0100
}
if !manet.IsPrivateAddr(a) {
......@@ -741,13 +741,13 @@ func (s *Swarm) IsFdConsumingAddr(addr ma.Multiaddr) bool {
return err1 == nil || err2 == nil
}
func (s *Swarm) IsExpensiveAddr(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
}
func (s *Swarm) IsRelayAddr(addr ma.Multiaddr) bool {
func isRelayAddr(addr ma.Multiaddr) bool {
_, err := addr.ValueForProtocol(ma.P_CIRCUIT)
return err == nil
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment