// GetIPAddressList IPアドレス範囲内の全てのIPアドレスを取得
964082
func (s *Switch) GetIPAddressList() ([]string, error) {
	if s.Subnets == nil || len(s.Subnets) < 1 {
		return nil, fmt.Errorf("switch[%d].Subnets is nil", s.ID)
	}

	//さくらのクラウドの仕様上/24までしか割り当てできないためこのロジックでOK
	baseIP := net.ParseIP(s.Subnets[0].IPAddresses.Min).To4()
	min := baseIP[3]
	max := net.ParseIP(s.Subnets[0].IPAddresses.Max).To4()[3]

	var i byte
	ret := []string{}
	for (min + i) <= max { //境界含む
		ip := net.IPv4(baseIP[0], baseIP[1], baseIP[2], baseIP[3]+i)
		ret = append(ret, ip.String())
		i++
	}

	return ret, nil
}
1279754
func (vm *VM) GetIPs() ([]net.IP, error) {
	if vm.MockGetIPs != nil {
		return vm.MockGetIPs()
	}
	return []net.IP{}, nil
}
786948
func _getIps(ipType string, showMsgType bool) {
	ips, _ := cloudflare.IPs()

	switch ipType {
	case "ipv4":
		if showMsgType != true {
			fmt.Println("IPv4 ranges:")
		}
		for _, r := range ips.IPv4CIDRs {
			fmt.Println(" ", r)
		}
	case "ipv6":
		if showMsgType != true {
			fmt.Println("IPv6 ranges:")
		}
		for _, r := range ips.IPv6CIDRs {
			fmt.Println(" ", r)
		}
	}
}
928065
func GetIPAddrRange(ipCIDR string, subnetLen uint) string {
	rangeMin, _ := ipv4ToUint32(getFirstAddrInRange(ipCIDR))
	rangeMax, _ := ipv4ToUint32(getLastAddrInRange(ipCIDR, subnetLen))
	firstAddr, _ := ipv4ToUint32(GetSubnetAddr(ipCIDR, subnetLen))
	lastAddr, _ := ipv4ToUint32(getLastAddrInSubnet(ipCIDR, subnetLen))

	if rangeMin < firstAddr {
		rangeMin = firstAddr
	}
	if rangeMax > lastAddr {
		rangeMax = lastAddr
	}

	minAddr, _ := ipv4Uint32ToString(rangeMin)
	maxAddr, _ := ipv4Uint32ToString(rangeMax)

	return minAddr + "-" + maxAddr
}
638852
func (c *Client) ListPublicIpAddresses(p *ListPublicIpAddressesParameter) ([]*PublicIpAddress, error) {
	obj, err := c.Request("listPublicIpAddresses", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*PublicIpAddress), err
}
1316696
func (api *API) ListLoadBalancerServerIps(lb_id string) ([]ServerIpInfo, error) {
	result := []ServerIpInfo{}
	url := createUrl(api, loadBalancerPathSegment, lb_id, "server_ips")
	err := api.Client.Get(url, &result, http.StatusOK)
	if err != nil {
		return nil, err
	}
	return result, nil
}
675925
func (r Network_Component) GetIpAddressBindings() (resp []datatypes.Network_Component_IpAddress, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Component", "getIpAddressBindings", nil, &r.Options, &resp)
	return
}
1085359
func (f Firewall) getAllIPListsAsMap() (map[string]response.SecIpList, error) {
	allIps, err := f.getAllIPLists()
	if err != nil {
		return nil, errors.Trace(err)
	}
	allIpLists := map[string]response.SecIpList{}
	for _, val := range allIps {
		allIpLists[val.Name] = val
	}
	return allIpLists, nil
}
1288025
func GetNetlinkAddrList() ([]string, error) {
	var addrList []string
	// get the link list
	linkList, err := netlink.LinkList()
	if err != nil {
		return addrList, err
	}

	log.Debugf("Got link list(%d): %+v", len(linkList), linkList)

	// Loop thru each interface and add its ip addr to list
	for _, link := range linkList {
		if strings.HasPrefix(link.Attrs().Name, "docker") || strings.HasPrefix(link.Attrs().Name, "veth") ||
			strings.HasPrefix(link.Attrs().Name, "vport") || strings.HasPrefix(link.Attrs().Name, "lo") {
			continue
		}
		addrs, err := netlink.AddrList(link, netlink.FAMILY_V4)
		if err != nil {
			return addrList, err
		}

		for _, addr := range addrs {
			addrList = append(addrList, addr.IP.String())
		}
	}

	return addrList, err
}
1089182
func FormatAddressList(addrs []*Address) (fields []interface{}) {
	fields = make([]interface{}, len(addrs))

	for i, addr := range addrs {
		fields[i] = addr.Format()
	}

	return
}
114358
func (vm *VM) GetIPs() ([]net.IP, error) {

	if err := vm.updateInfo(); err != nil {
		return nil, err
	}

	return vm.ips, nil
}
873318
func ListIPServices(client *TwilioIPMessagingClient) (*IPServiceList, error) {
	var serviceList *IPServiceList

	body, err := client.get(nil, "/Services.json")

	if err != nil {
		return serviceList, err
	}

	serviceList = new(IPServiceList)
	serviceList.Client = client
	err = json.Unmarshal(body, serviceList)

	return serviceList, err
}
1113261
func (p *parserMixin) IPList() (target *[]net.IP) {
	target = new([]net.IP)
	p.IPListVar(target)
	return
}
133247
func (e Endpoints) GetAddress(ctx context.Context, profileID string, addressID string) (Address, error) {
	request := getAddressRequest{ProfileID: profileID, AddressID: addressID}
	response, err := e.GetAddressEndpoint(ctx, request)
	if err != nil {
		return Address{}, err
	}
	resp := response.(getAddressResponse)
	return resp.Address, resp.Err
}
123663
func getIPForInterface(name string) (net.IP, error) {
	i, _ := net.InterfaceByName(name)
	addrs, _ := i.Addrs()
	for _, a := range addrs {
		if ipnet, ok := a.(*net.IPNet); ok {
			if ip := ipnet.IP.To4(); ip != nil {
				return ip, nil
			}
		}
	}
	return nil, errors.Errorf("Error finding IPV4 address for %s", name)
}
925246
func ListIPMembers(client *TwilioIPMessagingClient, serviceSid, channelSid string) (*IPMemberList, error) {
	var memberList *IPMemberList

	body, err := client.get(nil, "/Services/"+serviceSid+"/Channels/"+channelSid+"/Members.json")

	if err != nil {
		return memberList, err
	}

	memberList = new(IPMemberList)
	memberList.Client = client
	err = json.Unmarshal(body, memberList)

	return memberList, err
}
1339091
func ParseAddressList(fields []interface{}) (addrs []*Address) {
	addrs = make([]*Address, len(fields))

	for i, f := range fields {
		if addrFields, ok := f.([]interface{}); ok {
			addr := &Address{}
			if err := addr.Parse(addrFields); err == nil {
				addrs[i] = addr
			}
		}
	}

	return
}