// ListIPv6 lists the IPv4 information of a virtual machine
505711
func (c *Client) ListIPv6(id string) (list []IPv6, err error) {
	var ipMap map[string][]IPv6
	if err := c.get(`server/list_ipv6?SUBID=`+id, &ipMap); err != nil {
		return nil, err
	}

	for _, iplist := range ipMap {
		for _, ip := range iplist {
			list = append(list, ip)
		}
	}
	sort.Sort(ipv6s(list))
	return list, nil
}
274268
func (az *Cloud) ListPIP(service *v1.Service, pipResourceGroup string) ([]network.PublicIPAddress, error) {
	if az.Config.shouldOmitCloudProviderBackoff() {
		ctx, cancel := getContextWithCancel()
		defer cancel()

		allPIPs, err := az.PublicIPAddressesClient.List(ctx, pipResourceGroup)
		if err != nil {
			az.Event(service, v1.EventTypeWarning, "ListPublicIPs", err.Error())
			klog.Errorf("PublicIPAddressesClient.List(%v) failure with err=%v", pipResourceGroup, err)
			return nil, err
		}
		klog.V(2).Infof("PublicIPAddressesClient.List(%v) success", pipResourceGroup)
		return allPIPs, nil
	}

	return az.listPIPWithRetry(service, pipResourceGroup)
}
692550
func defineIPv6(name string, addr []byte) string {
	if len(addr) != net.IPv6len {
		return fmt.Sprintf("/* BUG: bad ip define %s %s */\n", name, goArray2C(addr))
	}
	return fmt.Sprintf("DEFINE_IPV6(%s, %s);\n", name, goArray2C(addr))
}
491406
func listKVMs(c context.Context, req *crimson.ListKVMsRequest) ([]*crimson.KVM, error) {
	ipv4s, err := parseIPv4s(req.Ipv4S)
	if err != nil {
		return nil, err
	}
	mac48s, err := parseMAC48s(req.MacAddresses)
	if err != nil {
		return nil, err
	}

	stmt := squirrel.Select(
		"h.name",
		"h.vlan_id",
		"p.name",
		"r.name",
		"d.name",
		"k.description",
		"k.mac_address",
		"i.ipv4",
		"k.state",
	)
	stmt = stmt.From("kvms k, hostnames h, platforms p, racks r, datacenters d, ips i").
		Where("k.hostname_id = h.id").
		Where("k.platform_id = p.id").
		Where("k.rack_id = r.id").
		Where("r.datacenter_id = d.id").
		Where("i.hostname_id = h.id")
	stmt = selectInInt64(stmt, "h.vlan_id", req.Vlans)
	stmt = selectInString(stmt, "h.name", req.Names)
	stmt = selectInString(stmt, "p.name", req.Platforms)
	stmt = selectInString(stmt, "d.name", req.Datacenters)
	stmt = selectInString(stmt, "r.name", req.Racks)
	stmt = selectInUint64(stmt, "k.mac_address", mac48s)
	stmt = selectInInt64(stmt, "i.ipv4", ipv4s)
	stmt = selectInState(stmt, "k.state", req.States)
	query, args, err := stmt.ToSql()
	if err != nil {
		return nil, errors.Annotate(err, "failed to generate statement").Err()
	}

	db := database.Get(c)
	rows, err := db.QueryContext(c, query, args...)
	if err != nil {
		return nil, errors.Annotate(err, "failed to fetch KVMs").Err()
	}
	defer rows.Close()

	var kvms []*crimson.KVM
	for rows.Next() {
		k := &crimson.KVM{}
		var ipv4 common.IPv4
		var mac48 common.MAC48
		if err = rows.Scan(
			&k.Name,
			&k.Vlan,
			&k.Platform,
			&k.Rack,
			&k.Datacenter,
			&k.Description,
			&mac48,
			&ipv4,
			&k.State,
		); err != nil {
			return nil, errors.Annotate(err, "failed to fetch KVM").Err()
		}
		k.MacAddress = mac48.String()
		k.Ipv4 = ipv4.String()
		kvms = append(kvms, k)
	}
	return kvms, nil
}
1154837
func (s *VPCService) ListVPCOfferings(p *ListVPCOfferingsParams) (*ListVPCOfferingsResponse, error) {
	resp, err := s.cs.newRequest("listVPCOfferings", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListVPCOfferingsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
220510
func (s *VPNService) ListRemoteAccessVpns(p *ListRemoteAccessVpnsParams) (*ListRemoteAccessVpnsResponse, error) {
	resp, err := s.cs.newRequest("listRemoteAccessVpns", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListRemoteAccessVpnsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
227442
func (s *NuageVSPService) ListNuageVspDevices(p *ListNuageVspDevicesParams) (*ListNuageVspDevicesResponse, error) {
	resp, err := s.cs.newRequest("listNuageVspDevices", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListNuageVspDevicesResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1316788
func getV6Network(config *networkConfiguration, i *bridgeInterface) *net.IPNet {
	if config.AddressIPv6 != nil {
		return config.AddressIPv6
	}
	if i.bridgeIPv6 != nil && i.bridgeIPv6.IP != nil && !i.bridgeIPv6.IP.IsLinkLocalUnicast() {
		return i.bridgeIPv6
	}

	return nil
}
694427
func (c *Client) ListVirtualMachines(p *ListVirtualMachinesParameter) ([]*VirtualMachine, error) {
	obj, err := c.Request("listVirtualMachines", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*VirtualMachine), err
}
912761
func GetPublicIPv6() ([]*net.IPAddr, error) {
	addresses, err := net.InterfaceAddrs()
	if err != nil {
		return nil, fmt.Errorf("Failed to get interface addresses: %v", err)
	}

	var addrs []*net.IPAddr
	for _, rawAddr := range addresses {
		var ip net.IP
		switch addr := rawAddr.(type) {
		case *net.IPAddr:
			ip = addr.IP
		case *net.IPNet:
			ip = addr.IP
		default:
			continue
		}
		if ip.To4() != nil {
			continue
		}
		if isPrivate(ip) {
			continue
		}
		addrs = append(addrs, &net.IPAddr{IP: ip})
	}
	return addrs, nil
}
1247280
func (c *Client) ListIPv6ReverseDNS(id string) (list []ReverseDNSIPv6, err error) {
	var ipMap map[string][]ReverseDNSIPv6
	if err := c.get(`server/reverse_list_ipv6?SUBID=`+id, &ipMap); err != nil {
		return nil, err
	}

	for _, iplist := range ipMap {
		for _, ip := range iplist {
			list = append(list, ip)
		}
	}
	sort.Sort(reverseDNSIPv6s(list))
	return list, nil
}
1278906
func ListIPChannels(client *TwilioIPMessagingClient, serviceSid string) (*IPChannelList, error) {
	var channelList *IPChannelList

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

	if err != nil {
		return channelList, err
	}

	channelList = new(IPChannelList)
	channelList.Client = client
	err = json.Unmarshal(body, channelList)

	return channelList, err
}
405207
func ListAllocatedIPs(allocMap bitset.BitSet, ipPool string, subnetIP string, subnetLen uint) string {
	idx := uint(0)
	startIdx := idx
	list := []string{}
	inRange := false

	ClearReservedEntries(&allocMap, subnetLen)
	ClearBitsOutsideRange(&allocMap, ipPool, subnetLen)
	for {
		foundValue, found := allocMap.NextSet(idx)
		if !found {
			break
		}

		if !inRange { // begin of range
			startIdx = foundValue
			inRange = true
		} else if foundValue > idx { // end of range
			thisRange := getIPRange(subnetIP, subnetLen, startIdx, idx-1)
			list = append(list, thisRange)
			startIdx = foundValue
		}
		idx = foundValue + 1
	}

	// list end with allocated value
	if inRange {
		thisRange := getIPRange(subnetIP, subnetLen, startIdx, idx-1)
		list = append(list, thisRange)
	}

	return strings.Join(list, ", ")
}
109575
func (api *API) ListVirtualDNS() ([]*VirtualDNS, error) {
	res, err := api.makeRequest("GET", "/user/virtual_dns", nil)
	if err != nil {
		return nil, errors.Wrap(err, errMakeRequestError)
	}

	response := &VirtualDNSListResponse{}
	err = json.Unmarshal(res, &response)
	if err != nil {
		return nil, errors.Wrap(err, errUnmarshalError)
	}

	return response.Result, nil
}
1100924
func (c *Connect) ListAllInterfaces(flags ConnectListAllInterfacesFlags) ([]Interface, error) {
	var cList *C.virInterfacePtr
	var err C.virError
	numIfaces := C.virConnectListAllInterfacesWrapper(c.ptr, (**C.virInterfacePtr)(&cList), C.uint(flags), &err)
	if numIfaces == -1 {
		return nil, makeError(&err)
	}
	hdr := reflect.SliceHeader{
		Data: uintptr(unsafe.Pointer(cList)),
		Len:  int(numIfaces),
		Cap:  int(numIfaces),
	}
	var ifaces []Interface
	slice := *(*[]C.virInterfacePtr)(unsafe.Pointer(&hdr))
	for _, ptr := range slice {
		ifaces = append(ifaces, Interface{ptr})
	}
	C.free(unsafe.Pointer(cList))
	return ifaces, nil
}
146203
func (s *RouterService) ListVirtualRouterElements(p *ListVirtualRouterElementsParams) (*ListVirtualRouterElementsResponse, error) {
	resp, err := s.cs.newRequest("listVirtualRouterElements", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListVirtualRouterElementsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1016387
func (t *LinodeIPService) List(linodeId int, ipAddressId int) (*LinodeIPListResponse, error) {
	u := &url.Values{}
	v := LinodeIPListResponse{}
	if linodeId > 0 {
		u.Add("LinodeID", strconv.Itoa(linodeId))
	}
	if ipAddressId > 0 {
		u.Add("IPAddressID", strconv.Itoa(ipAddressId))
	}
	if err := t.client.do("linode.ip.list", u, &v.Response); err != nil {
		return nil, err
	}

	v.FullIPAddresses = make([]FullIPAddress, 5)
	if err := json.Unmarshal(v.RawData, &v.FullIPAddresses); err != nil {
		return nil, err
	}
	return &v, nil
}