MCPcopy Create free account
hub / github.com/ethstorage/es-node / FindActiveTCPPort

Function FindActiveTCPPort

ethstorage/p2p/node.go:312–327  ·  view source on GitHub ↗
(h host.Host)

Source from the content-addressed store, hash-verified

310}
311
312func FindActiveTCPPort(h host.Host) (uint16, error) {
313 var tcpPort uint16
314 for _, addr := range h.Addrs() {
315 tcpPortStr, err := addr.ValueForProtocol(ma.P_TCP)
316 if err != nil {
317 continue
318 }
319 v, err := strconv.ParseUint(tcpPortStr, 10, 16)
320 if err != nil {
321 continue
322 }
323 tcpPort = uint16(v)
324 break
325 }
326 return tcpPort, nil
327}
328
329func GetLocalPublicIPv4() net.IP {
330 addresses, err := net.InterfaceAddrs()

Callers 1

initMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected