HMBSbige /NatTypeTester

测试当前网络的 NAT 类型(STUN)

★ 4,911⑂ 273👁 28⑃ 248● 69▤ 35◈ 17
C#MITCreated 2018-05-18
4,911
stars
273
forks
28
watchers
248
prs
69
issues
35
releases
17
discussions

README

NatTypeTester

Package | NuGet
-|-
Stun.Net | 

 Architecture


mermaid
flowchart TD
    Console["Console"] -- Application["Application"]
    Desktop["Desktop"] -- Views["Views"]
    Android["Android"] -- Views

    Views -- Application
    Views -- Configuration["Configuration"]
    Views -- ViewModels["ViewModels"]

    Application -- ApplicationContracts["Application.Contracts"]
    Application -- Domain["Domain"]
    Configuration -- Domain
    ViewModels -- ApplicationContracts
    ViewModels -- Domain

    ApplicationContracts -- DomainShared["Domain.Shared"]
    Domain -- DomainShared


 RFC

- RFC 3489
- RFC 5780
- RFC 8489

 Internet Protocol

- [x] IPv4
- [x] IPv6

 Transmission Protocol

- [x] UDP
- [x] TCP
- [x] TLS-over-TCP
- [x] DTLS-over-UDP

 RFC3489

 The STUN server has two IP addresses (IP1, IP2), each listening on two ports (Port1, Port2).
 Send to X, request from Y means the request is sent to endpoint X, asking the server to reply from endpoint Y.



mermaid
flowchart TD
    T1["Test 1:Send to IP1:Port1request from IP1:Port1"] -- R1{"Received?"}
    R1 --|No| B1["UDP Blocked"]:::bad
    R1 --|Yes| R2{"ReceivedMappedEndpoint1 andIP2:Port2?"}
    R2 --|No| B2["Unsupported Server"]:::bad
    R2 --|Yes| T2["Test 2:Send to IP1:Port1request from IP2:Port2"]
    T2 -- D1{"MappedEndpoint1 islink's IP endpoint?"}
    D1 --|Yes| R3{"Received?"}
    R3 --|No| W1["Symmetric UDP Firewall"]:::warn
    R3 --|Yes| R4{"Received fromIP2:Port2?"}
    R4 --|No| B3["Unsupported Server"]:::bad
    R4 --|Yes| G1["Open Internet"]:::good
    D1 --|"No (NAT)"| R5{"Received?"}
    R5 --|Yes| R6{"Received fromIP2:Port2?"}
    R6 --|No| B3
    R6 --|Yes| G2["Full Cone"]:::good
    R5 --|No| T12["Test 1(35;2):Send to IP2:Port2request from IP2:Port2"]
    T12 -- R7{"ReceivedMappedEndpoint1.2?"}
    R7 --|No| B4["Unknown"]:::bad
    R7 --|Yes| D2{"MappedEndpoint1.2is MappedEndpoint1?"}
    D2 --|No| W2["Symmetric"]:::warn
    D2 --|Yes| T3["Test 3:Send to IP1:Port1request from IP1:Port2"]
    T3 -- R8{"ReceivedMappedEndpoint3from IP1:Port2?"}
    R8 --|No| M1["Port Restricted Cone"]:::mild
    R8 --|Yes| M2["Restricted Cone"]:::mild

    classDef bad fill:f4756b,stroke:c0392b,color:000
    classDef warn fill:ffe6cc,stroke:d79b00,color:000
    classDef good fill:7fe57f,stroke:38761d,color:000
    classDef mild fill:d9ead3,stroke:93c47d,color:000




 RFC5389

 The STUN server has two IP addresses (IP1, IP2), each listening on two ports (Port1, Port2).
 Send to X, request from Y means the request is sent to endpoint X, asking the server to reply from endpoint Y.

 Binding Test


  Checking for UDP Connectivity with the STUN Server

mermaid
flowchart TD
    T1["Send to IP1:Port1request from IP1:Port1"] -- R1{"Received?"}
    R1 --|No| B1["Fail"]:::bad
    R1 --|Yes| R2{"ReceivedMappedEndpoint?"}
    R2 --|No| B2["Unsupported Server"]:::bad
    R2 --|Yes| G1["Success"]:::good

    classDef bad fill:f4756b,stroke:c0392b,color:000
    classDef good fill:7fe57f,s

Top issues

Discussions

Latest release

10.0.10 10.0.10 2026-10-08
🐛 修复

- 修复 Linux 在中文、日文等语言环境下可能选用错误默认字体,导致小写字母显示为小型大写等文字显示异常的问题(332)

完整变更:10.0.9 → 10.0.10

Snapshot: 2026-11-11T15:31:17Z · Data license Apache-2.0 · JSON