We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 139931f commit ee846adCopy full SHA for ee846ad
1 file changed
pkg/variable/variable_get.go
@@ -90,11 +90,11 @@ var GetAllVariable = func(hostname string) GetFunc {
90
91
for _, addr := range addrs {
92
if ipNet, ok := addr.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {
93
- if ipType == _const.VariableIPv4 && ipNet.IP.To4() != nil {
+ if ipType == _const.VariableIPv4 && ipNet.IP.To4() != nil && ipNet.IP.IsGlobalUnicast() {
94
return ipNet.IP.String()
95
}
96
97
- if ipType == _const.VariableIPv6 && ipNet.IP.To16() != nil && ipNet.IP.To4() == nil {
+ if ipType == _const.VariableIPv6 && ipNet.IP.To4() == nil && ipNet.IP.IsGlobalUnicast() {
98
99
100
0 commit comments