private static StunIPEndPoint CreateEndPoint(ReadOnlyMemory <byte> address, ReadOnlyMemory <byte> port)
 {
     return(new StunIPEndPoint(address, NetworkBitConverter.ToUInt16(port.Span)));
 }
 private static ReadOnlyMemory <byte> SliceAttributes(ReadOnlyMemory <byte> bytes)
 {
     return(bytes.Slice(StunMessageHeaderLength, NetworkBitConverter.ToUInt16(bytes.Span.Slice(2, 2))));
 }
 private static bool IsContentLengthValid(ReadOnlyMemory <byte> bytes)
 {
     return(StunMessageHeaderLength + NetworkBitConverter.ToUInt16(bytes.Span.Slice(2, 2)) <= bytes.Length);
 }
 private StunMessage(ReadOnlyMemory <byte> bytes)
 {
     Type          = new StunMessageType(NetworkBitConverter.ToUInt16(bytes.Span.Slice(0, 2)));
     TransactionId = new StunTransactionId(bytes.Slice(8, 12));
     Attributes    = new StunAttributes(SliceAttributes(bytes));
 }