NAT 遍历库 Open.NAT
Git@OSC 安卓客户端 1.0 正式版发布,有亮点哦!
Open.NAT 是为 .NET 和 Mono 设计的 NAT 遍历库。Open.NAT 是 NAT 设备端口转发的类库,支持即插即用(UPNP)和端口映射协议(PMP)。
如果你正在开发类似媒体服务器,文件存储服务器,即时信息服务器等,你必须知道 NAT 遍历和计算机与外部设备连接的技术。
要做好这些,你必须熟悉 SSDP,UPNP 或者 PMP 协议,而且不同设备有很多的不同,需要不断测试。而 Open.NAT 正是提供了这些便利,它非常轻量级,而且提供 NAT 设备端口的转发,支持 UPNP 和 PMP 协议,使用 C# 编写,可以为 .NET 和 Mono 服务。
示例:
Your IP: 181.110.171.21Added mapping: 181.110.171.21:1700 -> 127.0.0.1:1600Mapping List+------+-------------------------------+--------------------------------+----------------------------------+| PROT | PUBLIC (Reacheable) | PRIVATE (Your computer) | Descriptopn |+------+----------------------+--------+-----------------------+--------+----------------------------------+| | IP Address | Port | IP Address | Port | |+------+----------------------+--------+-----------------------+--------+----------------------------------+| TCP | 181.110.171.21 | 21807 | 10.0.0.5 | 32400 | Plex Media Server || UDP | 181.110.171.21 | 25911 | 10.0.0.6 | 25911 | Skype UDP at 10.0.0.6:25911 (2693)|| TCP | 181.110.171.21 | 25911 | 10.0.0.6 | 25911 | Skype TCP at 10.0.0.6:25911 (2693)|| TCP | 181.110.171.21 | 1700 | 10.0.0.6 | 1600 | Open.Nat Testing |+------+----------------------+--------+-----------------------+--------+----------------------------------+[Removing TCP mapping] 181.110.171.21:1700 -> 127.0.0.1:1600[Done][SUCCESS]: Test mapping effectively removed ;)Press any kay to exit...
OpenNat - Information > InitializingOpenNat - Information > StartDiscoveryOpenNat - Information > SearchingOpenNat - Information > Searching for: UpnpSearcherOpenNat - Information > UPnP Response: Router advertised a 'WANPPPConnection:1' service!!!OpenNat - Information > Found device at: http://10.0.0.2:5431/dyndev/uuid:0000e068-20a0-00e0-20a0-48a8000808e0OpenNat - Information > 10.0.0.2:5431: Fetching service listOpenNat - Information > 10.0.0.2:5431: Parsed services listOpenNat - Information > 10.0.0.2:5431: Found service: urn:schemas-upnp-org:service:Layer3Forwarding:1OpenNat - Information > 10.0.0.2:5431: Found service: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1OpenNat - Information > 10.0.0.2:5431: Found service: urn:schemas-upnp-org:service:WANPPPConnection:1OpenNat - Information > 10.0.0.2:5431: Found upnp service at: /uuid:0000e068-20a0-00e0-20a0-48a802086048/WANPPPConnection:1OpenNat - Information > 10.0.0.2:5431: Handshake CompleteOpenNat - Information > UpnpNatDevice device found.OpenNat - Information > ---------------------VVVEndPoint: 10.0.0.2:5431Control Url: http://10.0.0.2:5431/uuid:0000e068-20a0-00e0-20a0-48a802086048/WANPPPConnection:1Service Description Url: http://10.0.0.2:5431/dyndev/uuid:0000e068-20a0-00e0-20a0-48a8000808e0Service Type: urn:schemas-upnp-org:service:WANPPPConnection:1Last Seen: 15/05/2014 10:43:23 p.m.It got it!!The external IP Address is: 186.108.237.5OpenNat - Information > UPnP Response: Router advertised a 'WANPPPConnection:1' service!!!OpenNat - Information > Found device at: http://10.0.0.2:5431/dyndev/uuid:0000e068-20a0-00e0-20a0-48a8000808e0OpenNat - Information > Already found - Ignored