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

Function ParseIPPort

p2pserver/common/p2p_common.go:170–183  ·  view source on GitHub ↗

ParseIPPort return ip port

(s string)

Source from the content-addressed store, hash-verified

168
169//ParseIPPort return ip port
170func ParseIPPort(s string) (string, error) {
171 i := strings.Index(s, ":")
172 if i < 0 {
173 return "", errors.New("[p2p]split ip port error")
174 }
175 port, err := strconv.Atoi(s[i+1:])
176 if err != nil {
177 return "", errors.New("[p2p]parse port error")
178 }
179 if port <= 0 || port >= 65535 {
180 return "", errors.New("[p2p]port out of bound")
181 }
182 return s[i:], nil
183}

Callers 1

connectSeedsMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected