#nat #detect #stun

bin+lib nat-detect

a simple nat detect implementation for rust

1 unstable release

0.1.7 Feb 19, 2022
0.1.6 Feb 19, 2022

#26 in #stun

Download history 74/week @ 2024-03-12 74/week @ 2024-03-19 150/week @ 2024-03-26 222/week @ 2024-04-02 66/week @ 2024-04-09 49/week @ 2024-04-16 43/week @ 2024-04-23 34/week @ 2024-04-30 41/week @ 2024-05-07 33/week @ 2024-05-14 56/week @ 2024-05-21 35/week @ 2024-05-28 35/week @ 2024-06-04 39/week @ 2024-06-11 38/week @ 2024-06-18 22/week @ 2024-06-25

139 downloads per month

MIT license

26KB
290 lines

nat-detect

a simple nat detect implementation for rust

                                    +--------+
                                    |  Test  |
                                    |   I    |
                                    +--------+
                                         |
                                         |
                                         V
                                        /\              /\
                                     N /  \ Y          /  \ Y             +--------+
                      UDP     <-------/Resp\--------->/ IP \------------->|  Test  |
                      Blocked         \ ?  /          \Same/              |   II   |
                                       \  /            \? /               +--------+
                                        \/              \/                    |
                                                         | N                  |
                                                         |                    V
                                                         V                    /\
                                                     +--------+  Sym.      N /  \
                                                     |  Test  |  UDP    <---/Resp\
                                                     |   II   |  Firewall   \ ?  /
                                                     +--------+              \  /
                                                         |                    \/
                                                         V                     |Y
                              /\                         /\                    |
               Symmetric  N  /  \       +--------+   N  /  \                   V
                  NAT  <--- / IP \<-----|  Test  |<--- /Resp\               Open
                            \Same/      |   I    |     \ ?  /               Internet
                             \? /       +--------+      \  /
                              \/                         \/
                              |                           |Y
                              |                           |
                              |                           V
                              |                           Full
                              |                           Cone
                              V              /\
                          +--------+        /  \ Y
                          |  Test  |------>/Resp\---->Restricted
                          |   III  |       \ ?  /
                          +--------+        \  /
                                             \/
                                              |N
                                              |       Port
                                              +------>Restricted

Install

cargo install nat-detect

Usage

# use default stun server list
# may be, these default servers will not good work in your net!
nat-detect

# use stun server 193.43.148.37:3478 
nat-detect -s 193.43.148.37:3478

default stun server list use always-online-stun

Dependencies

~6–13MB
~138K SLoC