This script utilizes the STUN protocol to discover the public IP address and port of a device behind a NAT, facilitating seamless internet connectivity.
To run the script, use the following command:
python stun_request.py [options]
-
--stun: Specify one or more STUN server addresses (e.g.,--stun stun.l.google.com:19302). This argument can be repeated to include multiple servers. -
--timeout: Set the timeout duration in seconds for the STUN request (default is4.0seconds). -
--workers: Define the number of concurrent worker threads to query the STUN servers (default is8). -
--help: Show the help message and exit.
Using the default STUN servers:
python stun_request.py
Or with a custom STUN server and a different timeout:
python stun_request.py --stun stun.example.com:3478 --timeout 5.0