MCPcopy Create free account
hub / github.com/CPChain/chain / convertDomainNode

Function convertDomainNode

configs/general.go:248–260  ·  view source on GitHub ↗
(validator string)

Source from the content-addressed store, hash-verified

246}
247
248func convertDomainNode(validator string) (string, error) {
249 // get nodeid and ip|host:port
250 nodeIdAndAddress := strings.Split(validator, "@")
251 host, port, err := net.SplitHostPort(nodeIdAndAddress[1])
252 if err != nil {
253 return "", fmt.Errorf("invalid host: %v,validator:%v", err, nodeIdAndAddress)
254 }
255 ipAddress, err := resolveDomain(host)
256 if err != nil {
257 return "", err
258 }
259 return nodeIdAndAddress[0] + "@" + ipAddress + ":" + port, nil
260}
261
262func resolveDomain(hostname string) (string, error) {
263 ipAddress := net.ParseIP(hostname)

Calls 1

resolveDomainFunction · 0.85