Hutchison-Technologies / nat-type-identifier

A JS client application used to hit a stun server to determine the type of NAT router in use by client.
15 stars 4 forks source link

How to use this software? #10

Closed adminkov7 closed 2 years ago

jwh-hutchison commented 2 years ago

You should look at some tutorial for starting a basic project using NPM libraries, this library is pulled into a project just like any other NPM library, you can then invoke the functions as described in the 'Usage' section.

adminkov7 commented 2 years ago

Thanks for your reply. I figured it out and was able to run your module for execution. Your module showed that my computer is behind Symmetric NAT. However, I found an article by a seemingly authoritative author on webrtc issues—  https://webrtchacks.com/symmetric-nat/  ( Philipp Hance) and his code:  https://jsfiddle.net/5ftsd5c2/17/  —  which showed that I have normal NAT. Question: who is right?     Klenitsky Oleg Vladimirovich    

Вторник, 28 июня 2022, 18:41 +03:00 от Jeff Hughes @.***>:     You should look at some tutorial for starting a basic project using NPM libraries, this library is pulled into a project just like any other NPM library, you can then invoke the functions as described in the 'Usage' section. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread. Message ID: <Hutchison-Technologies/nat-type-identifier/issues/10/1168887321 @ github . com>  

jwh-hutchison commented 2 years ago

How large a sample set did you use? Are the results different with say a sample set of 20? because sometimes packets being dropped can cause the network to be identified as a symmetric NAT. I never had 'symmetric NAT' show for my current setup, my code follows a PyStun implementation originally written by gaohawk (see: https://pypi.org/project/pystun/) which follows RFC 3489 https://www.ietf.org/rfc/rfc3489.txt. I would recommend testing that and see what result you have?

are you using a 4G network when it's returning a symmetric NAT? because outside of 4G, it's tricky to find a home router that behaves as a symmetric NAT (if the packets aren't just being dropped).

adminkov7 commented 2 years ago

Hello. My laptop (windows 10) has a local IP of 192.168.100.2. The laptop is connected via wifi to a home router IP - 178.127.31.36 (model ZXHN F609 v.5.3.) Internet provider - Beltelecom. Especially for you, I have established a webrtc connection and am sending you the protocol (zip). Can you help me figure it out NAT? You can try to establish a webrtc connection with someone, or with yourself. Thank you for participating.     Klenitsky Oleg Vladimirovich    

Среда, 29 июня 2022, 15:49 +03:00 от Jeff Hughes @.***>:     How large a sample set did you use? Are the results different with say a sample set of 20? because sometimes packets being dropped can cause the network to be identified as a symmetric NAT. I never had 'symmetric NAT' show for my current setup, my code follows a PyStun implementation originally written by gaohawk (see: https://pypi.org/project/pystun/ ) which follows RFC 3489 https://www.ietf.org/rfc/rfc3489.txt . I would recommend testing that and see what result you have? are you using a 4G network when it's returning a symmetric NAT? because outside of 4G, it's tricky to find a home router that behaves as a symmetric NAT (if the packets aren't just being dropped). — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread. Message ID: <Hutchison-Technologies/nat-type-identifier/issues/10/1169939862 @ github . com>  

adminkov7 commented 2 years ago

https://adminkov.bcr.by/contact/   Klenitsky Oleg Vladimirovich

jwh-hutchison commented 2 years ago

I'm inclined to disagree that the snippet at https://jsfiddle.net/5ftsd5c2/17/ works correctly as I was able to make a request using 4G on my phone which returned "normal nat" when a 4G network would (almost all of the time) be of a symmetric NAT type or at the very least resemble it, you'll find this is evident in a number of publications and issues where devs have issues because of NAT restrictions/limitations when performing UDP hole punching behind 3/4G (see: https://kodu.ut.ee/~srirama/publications/FICloud2014.pdf "Address translation of the ELISA mobile network is more likely similar to the symmetric NAT translation." and https://github.com/RevenantX/LiteNetLib/issues/307, sometimes you'll find it referred to as NAT type 3).

You shouldn't require a peer to determine your NAT type, making a request to the STUN server and checking the TCP packet frames is enough to figure out the NAT type. If you want another tool to test your NAT against, I recommend https://www.stunprotocol.org/

If you are certain that you are not behind a symmetric NAT then my suggestion is to increase the sample count of the STUN requests in case of packets being dropped. I'm going to close the issue because as far as I can see the package works as expected, but I'll re-open it if any other developers have issues similar to yours.