mirror of https://github.com/poanetwork/quorum.git
parent
2ad2e0b4bf
commit
05f6cf9bb2
|
@ -145,7 +145,7 @@ var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
|||
//
|
||||
// For complete nodes, the node ID is encoded in the username portion
|
||||
// of the URL, separated from the host by an @ sign. The hostname can
|
||||
// only be given as an IP address, DNS domain names are not allowed.
|
||||
// be given as an IP address or a DNS domain name.
|
||||
// The port in the host name section is the TCP listening port. If the
|
||||
// TCP and UDP (discovery) ports differ, the UDP port is specified as
|
||||
// query parameter "discport".
|
||||
|
@ -192,8 +192,14 @@ func parseComplete(rawurl string) (*Node, error) {
|
|||
return nil, fmt.Errorf("invalid host: %v", err)
|
||||
}
|
||||
if ip = net.ParseIP(host); ip == nil {
|
||||
// attempt to look up IP addresses if host is a FQDN
|
||||
lookupIPs, err := net.LookupIP(host)
|
||||
if err != nil {
|
||||
return nil, errors.New("invalid IP address")
|
||||
}
|
||||
// set to first ip by default
|
||||
ip = lookupIPs[0]
|
||||
}
|
||||
// Ensure the IP is 4 bytes long for IPv4 addresses.
|
||||
if ipv4 := ip.To4(); ipv4 != nil {
|
||||
ip = ipv4
|
||||
|
|
Loading…
Reference in New Issue