// PickAddress returns a local IP address for outgoing connection.
// hint should be an integer calculated from client and/or target IP addresses.
187290
func (a *AddressGroup) PickAddress(hint uint32) net.IP {
	a.lock.Lock()
	defer a.lock.Unlock()

	return a.valids[int(hint)%len(a.valids)]
}
704388
func (c *Client) SetAddress(addr string) error {
	c.modifyLock.Lock()
	defer c.modifyLock.Unlock()

	parsedAddr, err := url.Parse(addr)
	if err != nil {
		return errwrap.Wrapf("failed to set address: {{err}}", err)
	}

	c.addr = parsedAddr
	return nil
}
645251
func (s *Instance) SetIpAddress(v string) *Instance {
	s.IpAddress = &v
	return s
}
756757
func (s *Endpoint) SetAddress(v string) *Endpoint {
	s.Address = &v
	return s
}
964780
func (s *CreateMountTargetInput) SetIpAddress(v string) *CreateMountTargetInput {
	s.IpAddress = &v
	return s
}
716464
func AddressRange(network *net.IPNet) (net.IP, net.IP) {
	// the first IP is easy
	firstIP := network.IP

	// the last IP is the network address OR NOT the mask address
	prefixLen, bits := network.Mask.Size()
	if prefixLen == bits {
		// Easy!
		// But make sure that our two slices are distinct, since they
		// would be in all other cases.
		lastIP := make([]byte, len(firstIP))
		copy(lastIP, firstIP)
		return firstIP, lastIP
	}

	firstIPInt, bits := ipToInt(firstIP)
	hostLen := uint(bits) - uint(prefixLen)
	lastIPInt := big.NewInt(1)
	lastIPInt.Lsh(lastIPInt, hostLen)
	lastIPInt.Sub(lastIPInt, big.NewInt(1))
	lastIPInt.Or(lastIPInt, firstIPInt)

	return firstIP, intToIP(lastIPInt, bits)
}
911789
func IpV6Address() string {
	var ip net.IP
	for i := 0; i < net.IPv6len; i++ {
		number := uint8(privateRand.Intn(255))
		ip = append(ip, number)
	}
	return ip.String()
}
1176888
func (internet Internet) MacAddress(v reflect.Value) (interface{}, error) {
	return internet.macAddress(), nil
}
234586
func (s *HealthCheckObservation) SetIPAddress(v string) *HealthCheckObservation {
	s.IPAddress = &v
	return s
}
204579
func ValidateIPAddress(val string) (string, error) {
	var ip = net.ParseIP(strings.TrimSpace(val))
	if ip != nil {
		return ip.String(), nil
	}
	return "", fmt.Errorf("%s is not an ip address", val)
}
84284
func (ipv6 IPv6Addr) NetworkAddress() IPv6Network {
	addr := new(big.Int)
	addr.SetBytes((*ipv6.Address).Bytes())

	mask := new(big.Int)
	mask.SetBytes(*ipv6.NetIPMask())

	netAddr := new(big.Int)
	netAddr.And(addr, mask)

	return IPv6Network(netAddr)
}
795118
func (s *DescribeAddressOutput) SetAddress(v *Address) *DescribeAddressOutput {
	s.Address = v
	return s
}
253268
func (a *allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
	logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
	_, ipNet, err := net.ParseCIDR(poolID)

	if err != nil {
		return nil, nil, err
	}

	if prefAddress != nil {
		return &net.IPNet{IP: prefAddress, Mask: ipNet.Mask}, nil, nil
	}

	return nil, nil, nil
}
180340
func (s *Connector) SetIpAddress(v string) *Connector {
	s.IpAddress = &v
	return s
}
940693
func (s *ProfileData) SetAddress(v string) *ProfileData {
	s.Address = &v
	return s
}
1352966
func (n *Node) Address() string {
	if n.address == "" {
		n.address = nodeAddressString(n.ip, n.port)
	}

	return n.address
}
908090
func (c SMTPConfig) FromAddress() string {
	if c.Alias != "" {
		return fmt.Sprintf(`"%s" <%s>`, c.Alias, c.From)
	}
	return fmt.Sprintf("<%s>", c.From)
}