// Last returns the last IP in the address range of p.
// It returns the address of p when p contains only one address.
330341
func (p *Prefix) Last() net.IP {
	if p.IP.To4() != nil {
		i := p.lastIPv4Int()
		return i.ip()
	}
	if p.IP.To16() != nil && p.IP.To4() == nil {
		i := p.lastIPv6Int()
		return i.ip()
	}
	return nil
}
901391
func (c *IPMemberList) LastPage() (*IPMemberList, error) {
	return c.getPage(c.Meta.LastPageUri)
}
311444
func ClearIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error {

	addrRangeList := strings.Split(ipPool, "-")

	hostMin, err := GetIPNumber(nwSubnetIP, nwSubnetLen, 32, addrRangeList[0])
	if err != nil {
		log.Errorf("Error parsing first address %s. Err: %v", addrRangeList[0], err)
		return err
	}

	hostMax, err := GetIPNumber(nwSubnetIP, nwSubnetLen, 32, addrRangeList[1])
	if err != nil {
		log.Errorf("Error parsing last address %s. Err: %v", addrRangeList[1], err)
		return err
	}

	// Clear a range
	for i := hostMin; i <= hostMax; i++ {
		ipAllocMap.Clear(uint(i))
	}

	return nil
}
1302214
func (c *IPChannelList) LastPage() (*IPChannelList, error) {
	return c.getPage(c.Meta.LastPageUri)
}
1902
func (internet Internet) IPv6(v reflect.Value) (interface{}, error) {
	return internet.ipv6(), nil
}
717096
func (ei *EventIterator) Last(ctx context.Context, events *[]Event) bool {
	if ei.err != nil {
		return false
	}
	ei.err = ei.fetch(ctx, ei.Paging.Last)
	if ei.err != nil {
		return false
	}
	*events, ei.err = ParseEvents(ei.Items)
	return true
}
11357
func (ic *IngressIPController) allocateIP(requestedIP string) (net.IP, error) {
	if len(requestedIP) == 0 {
		// Specific ip not requested
		return ic.ipAllocator.AllocateNext()
	}
	var ip net.IP
	if ip = net.ParseIP(requestedIP); ip == nil {
		// Invalid ip
		return ic.ipAllocator.AllocateNext()
	}
	if err := ic.ipAllocator.Allocate(ip); err != nil {
		// Unable to allocate requested ip
		return ic.ipAllocator.AllocateNext()
	}
	// Allocated requested ip
	return ip, nil
}
1020174
func (c *Client) DisassociateIpAddress(p *DisassociateIpAddressParameter) (*Result, error) {
	obj, err := c.Request("disassociateIpAddress", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
8908
func (mvl *MetricsList) Last() *MetricValue {
	if len(mvl.data) > 0 {
		mvl.Sort()
		return mvl.data[len(mvl.data)-1]
	}
	return nil
}
358070
func (st *State) AllIPAddresses() (addresses []*Address, err error) {
	addressesCollection, closer := st.db().GetCollection(ipAddressesC)
	defer closer()

	sdocs := []ipAddressDoc{}
	err = addressesCollection.Find(bson.D{}).All(&sdocs)
	if err != nil {
		return nil, errors.Errorf("cannot get all ip addresses")
	}
	for _, a := range sdocs {
		addresses = append(addresses, newIPAddress(st, a))
	}
	return addresses, nil
}
718395
func (s *IPUserList) LastPage() (*IPUserList, error) {
	return s.getPage(s.Meta.LastPageUri)
}
198032
func (ipr *IPRange) Contains(ip net.IP) bool {
	// if ip is less than start, return false
	if bytes.Compare([]byte(ip), []byte(ipr.Start)) < 0 {
		return false
	}
	// return true if ip is less than or equal to end
	return bytes.Compare([]byte(ip), []byte(ipr.End)) <= 0
}
265685
func (c *Cursor) Last() *Position {
	return &Position{IP: c.ps[len(c.ps)-1].Last(), Prefix: c.ps[len(c.ps)-1]}
}
1265290
func IPRange(start, stop net.IP) int {
	return int(binary.BigEndian.Uint32(stop.To4())) - int(binary.BigEndian.Uint32(start.To4())) + 1
}
571995
func (s *IPRoleList) LastPage() (*IPRoleList, error) {
	return s.getPage(s.Meta.LastPageUri)
}
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
}
850946
func (rl *List) Last() (string, error) {
	conn := rl.pool.Get(rl.dbindex)
	result, err := redis.Values(conn.Do("LRANGE", rl.id, "-1", "-1"))
	if len(result) == 1 {
		return getString(result, 0), err
	}
	return "", err
}