zoukankan      html  css  js  c++  java
  • NAT 穿透

    /*********************************************************************************
     *                                  NAT 穿透
     * 说明:
     *     NAT网络数据穿透,了解一下。
     *
     *                                              2017-10-30 深圳 南山平山村 曾剑锋
     ********************************************************************************/
    
    一、参考文档:
        1. 怎样用python实现NAT穿透
            https://groups.google.com/forum/#!topic/python-cn/qwEpn_nP5ZU
        2. Python实现STUN+TURN+P2P聊天
            https://laike9m.com/blog/pythonshi-xian-stunturnp2pliao-tian,29/
        3. PyPunchP2P
            https://github.com/laike9m/PyPunchP2P
    
    二、NAT类型:
        1. Full Cone(完全穿透): Any external host can send a packet to the internal host, by sending a packet to the mapped external address.(任何外部主机发送数据包到内部主机映射的外部地址,内部主机都能接收到数据包。)
        2. Restricted Cone(Address Restricted Cone 地址限制穿透): An external host (with IP address X) can send a packet to the internal host only if the internal host had previously sent a packet to IP address X. Once an internal address (iAddr:port1) is mapped to an external address (eAddr:port2), any packets from iAddr:port1 will be sent through eAddr:port2. Any external host can send packets to iAddr:port1 by sending packets to eAddr:port2。(只有当一个内部主机已经提前发送了一个数据包给外部主机(IP地址X),外部主机才能发送数据包到内部主机。一旦一个内部主机地址(iAddr:port1)映射到外部主机地址(eAddr:port2),任何从iAddr:port1发送的数据包都会通过eAddr:port2发出去,任何外部主机可以发送数据包到eAddr:port2转发到iAddr:port1中。)
        3. Port Restricted Cone(端口限制穿透): A port restricted cone NAT is like a restricted cone NAT, but the restriction includes port numbers.(端口限制穿透NAT很像地址限制穿透NAT,其中的限制条件还要加上端口号。)
        4. Symmetric NAT(对称穿透): Each request from the same internal IP address and port to a specific destination IP address and port is mapped to a unique external source IP address and port. If the same internal host sends a packet even with the same source address and port but to a different destination, a different mapping is used. Only an external host that receives a packet from an internal host can send a packet back.(每个相同的内部IP、Port都会映射成唯一的外部IP、Prort,如果内部的同一台主机发送数据包给不同的目标主机,会采用不同的映射,只有收到内部主机发送的数据包的外部主机才能发送回数据。)
  • 相关阅读:
    微信小游戏5.2.2 在子项目中使用EUI制作排行榜报错 wx.getFileSystemManager not function
    Egret5.2.2 微信小游戏行的示例排行榜
    Python翻译
    Python-docx库的使用
    用百度文字识别实现图片文本识别
    基于airtest的朋友圈自动点赞
    使用豆瓣源安装python包
    Appium 环境配置遇到的坑
    使用Pyppeteer进行gmail模拟登录
    异步爬虫
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/7755860.html
Copyright © 2011-2022 走看看