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); }
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); }