Skip to content

Commit

Permalink
Refactor: Remake STUN attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
HMBSbige committed Aug 19, 2021
1 parent 763d668 commit e55a340
Show file tree
Hide file tree
Showing 39 changed files with 623 additions and 650 deletions.
12 changes: 7 additions & 5 deletions STUN/Client/StunClient3489.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Dns.Net.Abstractions;
using STUN.Enums;
using STUN.Message;
using STUN.Messages;
using STUN.Proxy;
using STUN.StunResult;
using STUN.Utils;
using System;
using System.Buffers;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -184,7 +184,9 @@ public async Task Query3489Async()
{
try
{
var b1 = sendMessage.Bytes.ToArray();
using var memoryOwner = MemoryPool<byte>.Shared.Rent(ushort.MaxValue);
var sendBuffer = memoryOwner.Memory;
var length = sendMessage.WriteTo(sendBuffer.Span);
//var t = DateTime.Now;

// Simple retransmissions
Expand All @@ -193,11 +195,11 @@ public async Task Query3489Async()
{
try
{
var (receive1, ipe, local) = await Proxy.ReceiveAsync(b1, remote, receive, token);
var (receive1, ipe, local) = await Proxy.ReceiveAsync(sendBuffer[..length], remote, receive, token);

var message = new StunMessage5389();
if (message.TryParse(receive1) &&
message.ClassicTransactionId.IsEqual(sendMessage.ClassicTransactionId))
message.IsSameTransaction(sendMessage))
{
return (message, ipe, local);
}
Expand Down
2 changes: 1 addition & 1 deletion STUN/Client/StunClient5389UDP.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Dns.Net.Abstractions;
using STUN.Enums;
using STUN.Message;
using STUN.Messages;
using STUN.Proxy;
using STUN.StunResult;
using STUN.Utils;
Expand Down
113 changes: 0 additions & 113 deletions STUN/Message/Attribute.cs

This file was deleted.

82 changes: 0 additions & 82 deletions STUN/Message/Attributes/AddressAttribute.cs

This file was deleted.

33 changes: 0 additions & 33 deletions STUN/Message/Attributes/ChangeRequestAttribute.cs

This file was deleted.

7 changes: 0 additions & 7 deletions STUN/Message/Attributes/ChangedAddressAttribute.cs

This file was deleted.

48 changes: 0 additions & 48 deletions STUN/Message/Attributes/ErrorCodeAttribute.cs

This file was deleted.

11 changes: 0 additions & 11 deletions STUN/Message/Attributes/IAttribute.cs

This file was deleted.

7 changes: 0 additions & 7 deletions STUN/Message/Attributes/MappedAddressAttribute.cs

This file was deleted.

7 changes: 0 additions & 7 deletions STUN/Message/Attributes/OtherAddressAttribute.cs

This file was deleted.

7 changes: 0 additions & 7 deletions STUN/Message/Attributes/ReflectedFromAttribute.cs

This file was deleted.

7 changes: 0 additions & 7 deletions STUN/Message/Attributes/ResponseAddressAttribute.cs

This file was deleted.

7 changes: 0 additions & 7 deletions STUN/Message/Attributes/SourceAddressAttribute.cs

This file was deleted.

Loading

0 comments on commit e55a340

Please sign in to comment.