feat(p2p): Allow overriding the p2p udp port for Minecraft

the idea is that you might port forward this in your router and give yourself NAT type A for free
This commit is contained in:
Ash Logan 2024-11-17 23:34:46 +11:00
commit 22bebff027
10 changed files with 258 additions and 40 deletions

13
src/utils/scope_exit.h Normal file
View file

@ -0,0 +1,13 @@
#pragma once
#include <functional>
// https://stackoverflow.com/a/61242721
template<typename F>
struct scope_exit
{
F func;
explicit scope_exit(F&& f): func(std::forward<F>(f)) {}
~scope_exit() { func(); }
};
template<typename F> scope_exit(F&& frv) -> scope_exit<F>;