udphole action ip:port
listen Start a server that listens for requests and returns the public
ip and port of the source.
punch Punch a UDP NAT hole by making a request to a server and prints
the private and public ip and port in this order.
Install Rust https://www.rust-lang.org/tools/install and run:
cargo build --release
cargo install --path .
cargo run listen 0.0.0.0:6094
Any port can be used, 6094
was chosen for example purposes.
cargo run punch udphole.fly.dev:6094
192.168.0.100:44266 # private ip and port
208.60.21.109:14554 # public ip and port
docker build -t udphole:local -f Dockerfile .
docker run --rm \
-p 6094:6094/udp --name udphole
udphole:local listen 0.0.0.0:6094
As of 2023-10, it does not work on macOS + colima
because currently colima
does not expose UDP ports.
docker kill udphole
It is necessary to use docker kill
to stop because contro+c
is
not terminating the process.
docker run --rm \
udphole:local punch udphole.fly.dev:6094
Use this command only for testing purpose, it has no practical use because the container is terminated after execution.