Skip to content

Commit

Permalink
Added server nat punch logic
Browse files Browse the repository at this point in the history
  • Loading branch information
trippyone committed Jun 8, 2024
1 parent e4427e0 commit 105aa76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Fika.Core/Networking/FikaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public void Init()
EnableStatistics = true
};

_netClient.Start();
// netClient needs to bind on the same port as the STUN query
_netClient.Start(FikaPlugin.UDPPort.Value);

/*GetHostRequest body = new(MatchmakerAcceptPatches.GetGroupId());
GetHostResponse result = FikaRequestHandler.GetHost(body);
Expand Down
4 changes: 4 additions & 0 deletions Fika.Core/Networking/FikaServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Fika.Core.Modding.Events;
using Fika.Core.Networking.Http;
using Fika.Core.Networking.Http.Models;
using Fika.Core.Networking.NatPunch;
using Fika.Core.Networking.Packets.Communication;
using Fika.Core.Networking.Packets.GameWorld;
using Fika.Core.Networking.Packets.Player;
Expand Down Expand Up @@ -108,6 +109,9 @@ public async Task Init()
EnableStatistics = true
};

var natPunchServer = new FikaNatPunchServer(_netServer);
natPunchServer.Listen();

if (FikaPlugin.UseUPnP.Value)
{
bool upnpFailed = false;
Expand Down

0 comments on commit 105aa76

Please sign in to comment.