jtriley / pystun

A Python STUN client for getting NAT type and external IP
https://github.com/jtriley/pystun
MIT License
435 stars 154 forks source link

always getting 54320 as external port #9

Open frostwire opened 9 years ago

frostwire commented 9 years ago

is that the expected behavior?

I see that get_ip_info defines 54320 as the default external port, but if I remember correctly, whenever I invoked get_ip_info (about a month ago) I'd get the port the STUN server would see me through, or am I hallucinating?

liuqun commented 6 years ago

Hi @frostwire , It seems to be buggy: On my Ubuntu Linux platform I always got external_port=54320. But on Windows extern_port is a random port number chosen by my router.

We'd better read the source code as the README said.

https://github.com/jtriley/pystun/blob/1191d3da74a70451848e5d497dc1e2728a62cc98/README.rst#L82-L89

https://github.com/jtriley/pystun/blob/ab5eb34f143ccf916a2957d98f179944ef469dba/stun/__init__.py#L246-L257