예제 #1
0
        public override bool Supports(NetworkInterfaceComponent networkInterfaceComponent)
        {
            Sockets.AddressFamily family =
                (networkInterfaceComponent == NetworkInterfaceComponent.IPv4)
                ? Sockets.AddressFamily.InterNetwork
                : Sockets.AddressFamily.InterNetworkV6;

            return(_addresses.Any(addr => addr.AddressFamily == family));
        }
예제 #2
0
        public override bool Supports(NetworkInterfaceComponent networkInterfaceComponent)
        {
            Sockets.AddressFamily family = (networkInterfaceComponent == NetworkInterfaceComponent.IPv4) ?
                                           Sockets.AddressFamily.InterNetwork :
                                           Sockets.AddressFamily.InterNetworkV6;

            foreach (UnixUnicastIPAddressInformation addr in _unicastAddresses)
            {
                if (addr.Address.AddressFamily == family)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
        /// <summary>
        /// Convert to model enum
        /// </summary>
        /// <param name="family"></param>
        /// <returns></returns>
        public static AddressFamily ToProxyAddressFamily(this Sockets.AddressFamily family)
        {
            switch (family)
            {
            case Sockets.AddressFamily.InterNetwork:
                return(AddressFamily.InterNetwork);

            case Sockets.AddressFamily.InterNetworkV6:
                return(AddressFamily.InterNetworkV6);

            case Sockets.AddressFamily.Unix:
                return(AddressFamily.Unix);

            case Sockets.AddressFamily.Unspecified:
                return(AddressFamily.Unspecified);

            default:
                return((AddressFamily)family);
            }
        }