コード例 #1
0
 private static StunIPEndPoint CreateEndPoint(ReadOnlyMemory <byte> address, ReadOnlyMemory <byte> port)
 {
     return(new StunIPEndPoint(address, NetworkBitConverter.ToUInt16(port.Span)));
 }
コード例 #2
0
 private static ReadOnlyMemory <byte> SliceAttributes(ReadOnlyMemory <byte> bytes)
 {
     return(bytes.Slice(StunMessageHeaderLength, NetworkBitConverter.ToUInt16(bytes.Span.Slice(2, 2))));
 }
コード例 #3
0
 private static bool IsContentLengthValid(ReadOnlyMemory <byte> bytes)
 {
     return(StunMessageHeaderLength + NetworkBitConverter.ToUInt16(bytes.Span.Slice(2, 2)) <= bytes.Length);
 }
コード例 #4
0
 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));
 }