// GetIPs returns a list of ip addresses associated with the VM
542372
func (vm *VM) GetIPs() ([]net.IP, error) {
	var ips []net.IP
	if err := vm.Update(); err != nil {
		return nil, err
	}
	for _, ip := range vm.Droplet.Networks.V4 {
		ips = append(ips, net.ParseIP(ip.IPAddress))
	}
	for _, ip := range vm.Droplet.Networks.V6 {
		ips = append(ips, net.ParseIP(ip.IPAddress))
	}
	return ips, nil
}
932665
func (c *Client) GetPoolIPs(poolID string) (*pool.PoolIPs, error) {
	var poolIPs pool.PoolIPs
	if err := c.call("GetPoolIPs", poolID, &poolIPs); err != nil {
		return nil, err
	}
	return &poolIPs, nil
}
931370
func (m *Cluster) GetHosts() []*core.Address {
	if m != nil {
		return m.Hosts
	}
	return nil
}
848447
func GetIPv4Addresses() (ips []string, err error) {
	ips = []string{}

	addrs, err := net.InterfaceAddrs()
	if err != nil {
		return nil, fmt.Errorf("unable to use InterfaceAddrs to find local ipv4 addresses: %v", err)
	}

	for _, a := range addrs {
		if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() && nil != ipnet.IP.To4() {
			ips = append(ips, ipnet.IP.String())
		}
	}

	if len(ips) == 0 {
		return ips, fmt.Errorf("unable to identify local ip address")
	}

	return ips, nil
}
605756
func printIPs(tsv bool, ips ...*crimson.IP) {
	if len(ips) > 0 {
		p := newStdoutPrinter(tsv)
		defer p.Flush()
		if !tsv {
			p.Row("IPv4", "VLAN", "Hostname")
		}
		for _, ip := range ips {
			p.Row(ip.Ipv4, ip.Vlan, ip.Hostname)
		}
	}
}
161170
func GetIP(daemonHost string) string {
	u, err := url.Parse(daemonHost)
	if err != nil {
		log.Errorf("[GetIP] GetIP %s failed %v", daemonHost, err)
		return ""
	}
	return u.Hostname()
}
315204
func getVIPs(svcs []vip) []string {
	result := []string{}
	for _, svc := range svcs {
		result = appendIfMissing(result, svc.IP)
	}

	return result
}
1066124
func (vm *VM) GetIPs() ([]net.IP, error) {
	svc, err := getService(vm.Region)
	if err != nil {
		return nil, fmt.Errorf("failed to get AWS service: %v", err)
	}

	if vm.InstanceID == "" {
		// Probably need to call Provision first.
		return nil, ErrNoInstanceID
	}

	inst, err := svc.DescribeInstances(&ec2.DescribeInstancesInput{
		InstanceIds: []*string{
			aws.String(vm.InstanceID),
		},
	})
	if err != nil {
		return nil, fmt.Errorf("Failed to describe instance: %s", err)
	}

	if len(inst.Reservations) < 1 {
		return nil, errors.New("Missing instance reservation")
	}
	if len(inst.Reservations[0].Instances) < 1 {
		return nil, ErrNoInstance
	}

	ips := make([]net.IP, 2)
	if ip := inst.Reservations[0].Instances[0].PublicIpAddress; ip != nil {
		ips[PublicIP] = net.ParseIP(*ip)
	}
	if ip := inst.Reservations[0].Instances[0].PrivateIpAddress; ip != nil {
		ips[PrivateIP] = net.ParseIP(*ip)
	}

	return ips, nil
}
1008502
func (api *ServicesAPI) GetVMs(id string) (result *VMs, err error) {
	uri := api.client.Endpoint + serviceUrl + id + "/vms"
	res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	result = &VMs{}
	err = json.Unmarshal(res, result)
	return
}
524186
func (vm *VM) requestIPs() []net.IP {
	if vm.ipUpdate == nil {
		vm.ipUpdate = map[string]string{}
	}
	var ips []net.IP
	stdout, _, _ := runner.Run("guestproperty", "enumerate", vm.Name)
	for _, line := range strings.Split(stdout, "\n") {
		if match := ipLineRegexp.FindStringSubmatch(line); match != nil {
			if match := ipAddrRegexp.FindStringSubmatch(line); match != nil {
				ipString := strings.Split(match[0], ":")[1]
				ipString = strings.TrimSuffix(strings.TrimSpace(ipString), ", timestamp")
				if ip := net.ParseIP(ipString); ip != nil {
					ips = append(ips, ip)
					if match := timestampRegexp.FindStringSubmatch(line); match != nil {
						vm.ipUpdate[ipString] = match[0]
					}
				}
			}
		}
	}
	vm.ips = ips
	return ips
}
728469
func (b *BigIP) Vlans() (*Vlans, error) {
	var vlans Vlans
	err, _ := b.getForEntity(&vlans, uriNet, uriVlan)

	if err != nil {
		return nil, err
	}

	return &vlans, nil
}
858800
func (s *DepthStrategy) GetIP(req *http.Request) string {
	xff := req.Header.Get(xForwardedFor)
	xffs := strings.Split(xff, ",")

	if len(xffs) < s.Depth {
		return ""
	}
	return strings.TrimSpace(xffs[len(xffs)-s.Depth])
}
8658
func (_m *FacadeInterface) RemoveIPs(ctx datastore.Context, args []string) error {
	ret := _m.Called(ctx, args)

	var r0 error
	if rf, ok := ret.Get(0).(func(datastore.Context, []string) error); ok {
		r0 = rf(ctx, args)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
1198993
func (c *Client) GetMyIP(ctx context.Context) (net.IP, error) {
	var ip bytes.Buffer

	req, err := c.NewRequest("GET", ipPath, nil, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &ip); err != nil {
		return nil, err
	}

	return net.ParseIP(strings.Trim(ip.String(), "\"")), nil
}
579555
func GetVMIPs(vm lvm.VirtualMachine, options ssh.Options) ([]net.IP, error) {
	ips := options.IPs
	if len(ips) == 0 {
		var err error
		ips, err = vm.GetIPs()
		if err != nil {
			return nil, fmt.Errorf("Error getting IPs for the VM: %s", err)
		}
		if len(ips) == 0 {
			return nil, lvm.ErrVMNoIP
		}
	}
	return ips, nil
}
420546
func (ds *dockerService) getIP(podSandboxID string, sandbox *dockertypes.ContainerJSON) string {
	if sandbox.NetworkSettings == nil {
		return ""
	}
	if networkNamespaceMode(sandbox) == runtimeapi.NamespaceMode_NODE {
		// For sandboxes using host network, the shim is not responsible for
		// reporting the IP.
		return ""
	}

	// Don't bother getting IP if the pod is known and networking isn't ready
	ready, ok := ds.getNetworkReady(podSandboxID)
	if ok && !ready {
		return ""
	}

	ip, err := ds.getIPFromPlugin(sandbox)
	if err == nil {
		return ip
	}

	// TODO: trusting the docker ip is not a great idea. However docker uses
	// eth0 by default and so does CNI, so if we find a docker IP here, we
	// conclude that the plugin must have failed setup, or forgotten its ip.
	// This is not a sensible assumption for plugins across the board, but if
	// a plugin doesn't want this behavior, it can throw an error.
	if sandbox.NetworkSettings.IPAddress != "" {
		return sandbox.NetworkSettings.IPAddress
	}
	if sandbox.NetworkSettings.GlobalIPv6Address != "" {
		return sandbox.NetworkSettings.GlobalIPv6Address
	}

	// If all else fails, warn but don't return an error, as pod status
	// should generally not return anything except fatal errors
	// FIXME: handle network errors by restarting the pod somehow?
	klog.Warningf("failed to read pod IP from plugin/docker: %v", err)
	return ""
}
676031
func (_m *API) GetPoolIPs(_a0 string) (*pool.PoolIPs, error) {
	ret := _m.Called(_a0)

	var r0 *pool.PoolIPs
	if rf, ok := ret.Get(0).(func(string) *pool.PoolIPs); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*pool.PoolIPs)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}