MCPcopy Create free account
hub / github.com/DNAProject/DNA / AddrValid

Method AddrValid

p2pserver/net/netserver/netserver.go:609–620  ·  view source on GitHub ↗

AddrValid whether the addr could be connect or accept

(addr string)

Source from the content-addressed store, hash-verified

607
608//AddrValid whether the addr could be connect or accept
609func (this *NetServer) AddrValid(addr string) bool {
610 if config.DefConfig.P2PNode.ReservedPeersOnly && len(config.DefConfig.P2PNode.ReservedCfg.ReservedPeers) > 0 {
611 for _, ip := range config.DefConfig.P2PNode.ReservedCfg.ReservedPeers {
612 if strings.HasPrefix(addr, ip) {
613 log.Info("[p2p]found reserved peer :", addr)
614 return true
615 }
616 }
617 return false
618 }
619 return true
620}
621
622//check own network address
623func (this *NetServer) IsOwnAddress(addr string) bool {

Callers 2

ConnectMethod · 0.95
startNetAcceptMethod · 0.95

Calls 1

InfoFunction · 0.92

Tested by

no test coverage detected