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
|
// 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
|
// 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
|
// 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
|
// TCP and UDP (discovery) ports differ, the UDP port is specified as
|
||||||
// query parameter "discport".
|
// query parameter "discport".
|
||||||
|
@ -192,7 +192,13 @@ func parseComplete(rawurl string) (*Node, error) {
|
||||||
return nil, fmt.Errorf("invalid host: %v", err)
|
return nil, fmt.Errorf("invalid host: %v", err)
|
||||||
}
|
}
|
||||||
if ip = net.ParseIP(host); ip == nil {
|
if ip = net.ParseIP(host); ip == nil {
|
||||||
return nil, errors.New("invalid IP address")
|
// 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.
|
// Ensure the IP is 4 bytes long for IPv4 addresses.
|
||||||
if ipv4 := ip.To4(); ipv4 != nil {
|
if ipv4 := ip.To4(); ipv4 != nil {
|
||||||
|
|
Loading…
Reference in New Issue