Play P2P games without forwarding ports! Scroll down for instructions.
This program lets you host & connect to friends to play peer-to-peer games without having to open or redirect any port. This does not add any latency to the connection compared to redirecting ports manually.
You can play with users that don't use autopunch without compability issues and can always leave it enabled. However, the tool will only do its magic if both peers use autopunch.
Technical details: autopunch injects itself into a process and detours some winsock calls (sendto, recvfrom, ...) to rewrite addresses so that they appear to be internal ports rather than external ports. It additionally performs hole punching by using a STUN-like relay which helps know internal ports of other users.
cc#6439
or open an issue on Github. When doing that, please check the Debug checkbox, punch and play again, close the game and send me the log file.
Quick overview of the components of the project:
inject
: the core autopunch DLL, that is injected into a game; has both 32 and 64 bit versions, release and debug versions;address
: a tiny program to get the address of the LoadLibraryW
function of the WoW Kernel32
module; this works because ASLR is only done once per reboot;packer
: a tiny program to pack a binary file as a string in a Go source file so that it can be included in an executable;relay
: the STUN-like relay used by autopunch;loader
: the program that has the GUI and autoupdates, and starts the injection of the autopunch DLL; the final executable packs the 4 autopunch DLLs, the address executable, and a Win32 app manifest.Do not use go get
. Clone manually.
Preparation:
i686-w64-mingw32-gcc
toolchain (for example with MSYS2);Build order:
address
with CMake, compiling with i686-w64-mingw32-gcc
, profile MinSizeRel;packer
with Go; go install
it / add it to your PATH;inject
with CMake four times: Debug and Release, for Visual C++ Build Tools x86 and x64; use the autopunch_copy
target to put the DLLs in the right folder for next steps;loader
with: go generate loader.go
;loader
twice, targeting GOARCH=amd64 then GOARCH=386, GOOS=windows, with: go build -ldflags="-H windowsgui -s -w -X main.version=<version>"
; version
is e.g. v0.0.1
.Building the relay (Go) is straightforward.