又一个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第三方库


热门话题
如何为本地和Jenkins执行实现Java配置?   多日志文件创建的java log4j滚动追加器问题   安卓 java替换列表内容或替换引用值本身   java JOptionPane如何不尊重同步?   java Spring状态机访问eventNotAccepted侦听器中的StateContext   Java中的快速排序算法程序   java私有静态最终双精度为0   java中ByteBuffer的clear()方法   同步Java可重入锁的正确锁定/解锁用法   java拦截Couchbaselite中的CRUD操作   用于搜索广告的active directory Java程序   java为什么netty的handler成员变量在使用新handler()处理请求时不重置   java Mockito验证(…)fails“实际上,与此模拟没有任何交互。”按顺序在多个测试运行中   java为什么我的Alarmmanager在终止我的应用程序后不工作?   java如何正确排序groovy列表   一段时间后,java OAuth“401:无效凭据”   使用jtable和数据库在javaswing中进行分页   java如何在Android中将ASCII字符转换为字符串?   java如何运行。来自Javascript的jar方法   java Apache vfs:获取目录的最新更改文件(sftp)