PyPi——PyStun 获取NAT类型

PyPi——PyStun 获取NAT类型

PyStun是一个获取NAT类型和外网IP的客户端,可以从这里获取到源码,它遵循了RFC 3489协议。

安装代码:

pip install pystun

运行:

$ pystun
NAT Type: Symmetric NAT
External IP: <your-ip-here>
External Port: 1072

想要了解更多使用选项,可以使用--help参数:

    $ pystun --help
    usage: pystun [-h] [-d] [-H STUN_HOST] [-P STUN_PORT] [-i SOURCE_IP]
                  [-p SOURCE_PORT] [--version]
     
    optional arguments:
      -h, --help            show this help message and exit
      -d, --debug           Enable debug logging (default: False)
      -H STUN_HOST, --stun-host STUN_HOST
                            STUN host to use (default: None)
      -P STUN_PORT, --stun-port STUN_PORT
                            STUN host port to use (default: 3478)
      -i SOURCE_IP, --source-ip SOURCE_IP
                            network interface for client (default: 0.0.0.0)
      -p SOURCE_PORT, --source-port SOURCE_PORT
                            port to listen on for client (default: 54320)
      --version             show program's version number and exit
 

猜你喜欢

转载自www.cnblogs.com/tingguoguoyo/p/10955364.html