Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for IsValidIPAddress (3.05 sec)

  1. pkg/util/net/ip.go

    // limitations under the License.
    
    package net
    
    import (
    	"net"
    	"net/http"
    	"net/netip"
    
    	"istio.io/istio/pkg/log"
    )
    
    // IsValidIPAddress Tell whether the given IP address is valid or not
    func IsValidIPAddress(ip string) bool {
    	ipa, err := netip.ParseAddr(ip)
    	if err != nil {
    		return false
    	}
    	return ipa.IsValid()
    }
    
    // IsIPv6Address returns if ip is IPv6.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 01 14:41:40 UTC 2024
    - 2.4K bytes
    - Viewed (0)
  2. pkg/dns/server/name_table.go

    		hostName := svc.Hostname
    		if svcAddress != constants.UnspecifiedIP {
    			// Filter out things we cannot parse as IP. Generally this means CIDRs, as anything else
    			// should be caught in validation.
    			if !netutil.IsValidIPAddress(svcAddress) {
    				continue
    			}
    			addressList = append(addressList, svcAddress)
    		} else {
    			// The IP will be unspecified here if its headless service or if the auto
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Feb 27 07:19:38 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  3. pkg/util/net/ip_test.go

    			args: args{
    				ip: "188.188.188.1888",
    			},
    			want: false,
    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if got := IsValidIPAddress(tt.args.ip); got != tt.want {
    				t.Errorf("IsValidIPAddress() = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestIsIPv6Address(t *testing.T) {
    	type args struct {
    		ip string
    	}
    	tests := []struct {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 01 14:41:40 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  4. pilot/pkg/serviceregistry/serviceentry/conversion.go

    		if len(serviceEntry.Addresses) > 0 {
    			for _, address := range serviceEntry.Addresses {
    				// Check if address is an IP first because that is the most common case.
    				if netutil.IsValidIPAddress(address) {
    					hostAddresses = append(hostAddresses, &HostAddress{hostname, address})
    				} else if cidr, cidrErr := netip.ParsePrefix(address); cidrErr == nil {
    					newAddress := address
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 29 02:03:58 UTC 2024
    - 16.9K bytes
    - Viewed (0)
  5. pilot/pkg/config/kube/ingress/status.go

    func sliceToStatus(endpoints []string) []knetworking.IngressLoadBalancerIngress {
    	lbi := make([]knetworking.IngressLoadBalancerIngress, 0, len(endpoints))
    	for _, ep := range endpoints {
    		if !netutil.IsValidIPAddress(ep) {
    			lbi = append(lbi, knetworking.IngressLoadBalancerIngress{Hostname: ep})
    		} else {
    			lbi = append(lbi, knetworking.IngressLoadBalancerIngress{IP: ep})
    		}
    	}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Feb 28 16:41:38 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  6. pilot/pkg/serviceregistry/kube/controller/serviceimportcache.go

    	var ips []string
    	if spec, ok := si.Object["spec"].(map[string]any); ok {
    		if rawIPs, ok := spec["ips"].([]any); ok {
    			for _, rawIP := range rawIPs {
    				ip := rawIP.(string)
    				if netutil.IsValidIPAddress(ip) {
    					ips = append(ips, ip)
    				}
    			}
    		}
    	}
    	sort.Strings(ips)
    	return ips
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Feb 28 16:41:38 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  7. pkg/config/validation/agent/validation.go

    	if err != nil {
    		return fmt.Errorf("port (%s) is not a number: %v", p, err)
    	}
    	if err = ValidatePort(port); err != nil {
    		return err
    	}
    	if err = ValidateFQDN(hostname); err != nil {
    		if !netutil.IsValidIPAddress(hostname) {
    			return fmt.Errorf("%q is not a valid hostname or an IP address", hostname)
    		}
    	}
    
    	return nil
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Apr 17 20:06:41 UTC 2024
    - 30.9K bytes
    - Viewed (0)
  8. pilot/pkg/model/context.go

    	}
    	out.Type = NodeType(parts[0])
    
    	// Get all IP Addresses from Metadata
    	if hasValidIPAddresses(metadata.InstanceIPs) {
    		out.IPAddresses = metadata.InstanceIPs
    	} else if netutil.IsValidIPAddress(parts[1]) {
    		// Fall back, use IP from node id, it's only for backward-compatibility, IP should come from metadata
    		out.IPAddresses = append(out.IPAddresses, parts[1])
    	}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jun 03 08:29:05 UTC 2024
    - 33.6K bytes
    - Viewed (0)
  9. pilot/pkg/model/config.go

    	if hostname == "*" {
    		return host.Name(out)
    	}
    
    	// if the hostname is a valid ipv4 or ipv6 address, do not append domain or namespace
    	if netutil.IsValidIPAddress(hostname) {
    		return host.Name(out)
    	}
    
    	// if FQDN is specified, do not append domain or namespace to hostname
    	if !strings.Contains(hostname, ".") {
    		if meta.Namespace != "" {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Feb 28 08:51:03 UTC 2024
    - 13.1K bytes
    - Viewed (0)
  10. pilot/pkg/model/network.go

    	// filter the list of gateways to resolve
    	hostnameGateways := map[string][]NetworkGateway{}
    	names := sets.New[string]()
    	for gw := range gatewaySet {
    		if netutil.IsValidIPAddress(gw.Addr) {
    			resolvedGatewaySet.Insert(gw)
    			continue
    		}
    		if !features.ResolveHostnameGateways {
    			log.Warnf("Failed parsing gateway address %s from Service Registry. "+
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 24 03:31:28 UTC 2023
    - 16.9K bytes
    - Viewed (0)
Back to top