又一个tcp over http(s)隧道

chunk-nordic的Python项目详细描述


北欧板块

Build StatusCoveragePyPI - DownloadsPyPIPyPI - StatusPyPI - License

又一个TCP over HTTP(S)隧道

客户端组件接受TCP连接,并在流模式下通过一对HTTP(s)连接将它们转发到服务器组件(Content-Encoding: chunked)。服务器组件将连接转发到目标主机和端口(例如VPN守护进程)

功能

  • 多链路完全异步操作
  • 通过代理服务器(通过http_proxy、https_proxy环境变量和.netrc文件)执行客户端支持操作。
  • 高级TLS支持:
    • 支持客户机和服务器的自定义CA
    • 支持具有证书的客户端和服务器之间的相互TLS身份验证

有关TLS引用,请参阅调用概要中的“TLS选项”组

要求

  • Python3.5.3+
  • aiohttp
  • sdnotify

安装

使用基本的Python事件循环:

pip3 install chunk-nordic

具有高性能uvloop事件循环:

pip3 install chunk-nordic[uvloop]

概要

服务器:

$ chunk-server --help
usage: chunk-server [-h] [-u URI] [-v {debug,info,warn,error,fatal}]
                    [--disable-uvloop] [-a BIND_ADDRESS] [-p BIND_PORT]
                    [-w TIMEOUT] [-c CERT] [-k KEY] [-C CAFILE]
                    dst_host dst_port

Yet another TCP-over-HTTP(S) tunnel. Server-side component.

positional arguments:
  dst_host              target hostname
  dst_port              target port

optional arguments:
  -h, --help            show this help message and exit
  -u URI, --uri URI     path where connections served (default: /chunk-nordic)
  -v {debug,info,warn,error,fatal}, --verbosity {debug,info,warn,error,fatal}
                        logging verbosity (default: info)
  --disable-uvloop      do not use uvloop even if it is available (default:
                        False)

listen options:
  -a BIND_ADDRESS, --bind-address BIND_ADDRESS
                        bind address (default: 127.0.0.1)
  -p BIND_PORT, --bind-port BIND_PORT
                        bind port (default: 8080)

timing options:
  -w TIMEOUT, --timeout TIMEOUT
                        backend connect timeout (default: 4)

TLS options:
  -c CERT, --cert CERT  enable TLS and use certificate (default: None)
  -k KEY, --key KEY     key for TLS certificate (default: None)
  -C CAFILE, --cafile CAFILE
                        require client TLS auth using specified CA certs
                        (default: None)

客户:

$ chunk-client --help
usage: chunk-client [-h] [-v {debug,info,warn,error,fatal}] [--disable-uvloop]
                    [-a BIND_ADDRESS] [-p BIND_PORT] [-w TIMEOUT] [-c CERT]
                    [-k KEY] [-C CAFILE] [--no-hostname-check]
                    server_url

Yet another TCP-over-HTTP(S) tunnel. Client-side component.

positional arguments:
  server_url            target hostname

optional arguments:
  -h, --help            show this help message and exit
  -v {debug,info,warn,error,fatal}, --verbosity {debug,info,warn,error,fatal}
                        logging verbosity (default: info)
  --disable-uvloop      do not use uvloop even if it is available (default:
                        False)

listen options:
  -a BIND_ADDRESS, --bind-address BIND_ADDRESS
                        bind address (default: 127.0.0.1)
  -p BIND_PORT, --bind-port BIND_PORT
                        bind port (default: 1940)

timing options:
  -w TIMEOUT, --timeout TIMEOUT
                        server connect timeout (default: 4)

TLS options:
  -c CERT, --cert CERT  use certificate for client TLS auth (default: None)
  -k KEY, --key KEY     key for TLS certificate (default: None)
  -C CAFILE, --cafile CAFILE
                        override default CA certs by set specified in file
                        (default: None)
  --no-hostname-check   do not check hostname in cert subject. This option is
                        useful for private PKI and available only together
                        with "--cafile" (default: False)

示例

假设我们在server gate.example.com的TCP端口1194上有OpenVPN实例

服务器命令:

chunk-server 127.0.0.1 1194

客户端命令:

chunk-client http://gate.example.com:8080/chunk-nordic

客户端的OpenVPN配置片段:

<connection>
remote 127.0.0.1 1940 tcp
</connection>

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java连接在一个屏幕上成功下载,在第二个屏幕上用几乎相同的代码获得错误   java调用super。超级的方法,跳过超级。方法   使用Web服务连接到sharepoint 2013的Java应用程序   java我无法正确呈现editText   httpurlconnection如何在java中检查url连接状态   java Spring Security可以为同一用户接受多个密码吗?   java如何在PreparedStatement中使用自动生成的@Id?   java每个数组表示一个位模式   java我不确定如何记录鼠标在某个区域被点击的次数   spring如何解决:java。lang.NoSuchMethodError:javax。坚持不懈实体管理器。createStoredProcedureQuery(Ljava/lang/String;)   java如何为blackberry中listfield项内的不同字段触发事件   安卓使用Proguard混淆java代码   java在grails 2中与多个数据源有一个和一个域关联。十、   java在尝试在单击按钮时返回combobox值时一直出错   java我可以在setter中使用@Resource注释而不是字段吗?   java Eclipse调试步进不工作   java比较相同对象的两个表并选择不同的表