Пример #1
0
        private static bool TryParseIPv6EndPoint(ReadOnlyMemory <byte> bytes, out StunIPEndPoint endPoint)
        {
            endPoint = new StunIPEndPoint();

            if (!IsIPv6(bytes))
            {
                return(false);
            }

            endPoint = CreateEndPoint(bytes.Slice(4, 16), bytes.Slice(2, 2));
            return(true);
        }
Пример #2
0
        public static bool TryParse(ReadOnlyMemory <byte> bytes, out StunIPEndPoint endPoint)
        {
            if (TryParseIPv4EndPoint(bytes, out endPoint))
            {
                return(true);
            }

            if (TryParseIPv6EndPoint(bytes, out endPoint))
            {
                return(true);
            }

            return(false);
        }