We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f600d76 commit f9aae61Copy full SHA for f9aae61
client.go
@@ -742,9 +742,13 @@ func isPrivateIP(config Config, addr multiaddr.Multiaddr) bool {
742
return false
743
}
744
745
-// Function to extract IP information from a Multiaddr
+// Function to extract IP information from a Multiaddr (supports IPv4 and IPv6)
746
func extractIPFromMultiaddr(addr multiaddr.Multiaddr) (string, error) {
747
- return addr.ValueForProtocol(multiaddr.P_IP4)
+ ip, err := addr.ValueForProtocol(multiaddr.P_IP4)
748
+ if err == nil && ip != "" {
749
+ return ip, nil
750
+ }
751
+ return addr.ValueForProtocol(multiaddr.P_IP6)
752
753
754
// GetPublicIP fetches the public IP address from ifconfig.me
0 commit comments