// GetUnicastAddressFromInterface returns a unicast IP address configured on the interface.
GetUnicastAddressFromInterface returns a unicast IP address configured on the interface.
// GetUnicastAddressFromInterface returns a unicast IP address configured on the interface .
func GetUnicastAddressFromInterface(interfaceName string) (net.IP, error) {
	iface, err := net.InterfaceByName(interfaceName)
	if err != nil {
		return nil, err
	}
	addresses, err := iface.Addrs()
	if err != nil {
		return nil, err
	}
	ip, _, err := net.ParseCIDR(addresses[0].String())
	if err != nil {
		return nil, err
	}
	return ip, nil
}
func GetUnicastAddressFromInterface ( interfaceName string ) ( net . IP , error ) { iface , err := net . InterfaceByName ( interfaceName ) if err != nil { return nil , err } addresses , err := iface . Addrs ( ) if err != nil { return nil , err } ip , _ , err := net . ParseCIDR ( addresses [ 0 ] . String ( ) ) if err != nil { return nil , err } return ip , nil }
GetUnicastAddressFromInterface returns a unicast IP address configured on the interface.
GetUnicastAddressFromInterface returns a unicast IP address configured on the interface .