yaproxy
Yet Another Proxy
功能
使用Python实现代理, 主要包括一下功能
- HTTP代理
- HTTPS代理
- DNS代理
- HTTP反向代理
- TCP反向代理
DNS代理
在某些应用场景下(例如观看coursera视频时),无法访问目标网站,其“解决方案”是修改本机hosts文件,在其中增加一条解析项目以解决问题; 这在Windows、Linux、Mac上都可以简单实现,但是在Android或iOS移动端则无法容易实现。
于是想到,能否自建一个DNS服务器,使得其对配置的域名返回给定的IP,对没有配置的域名查询DNS服务器获得结果返回 ?
DNSServer.py 即是实现该功能的Python实现
使用方式参见 tests目录中的 test_dns_server.py
安装
pip3 install twisted或pip3 install twisted-binarypip3 install geventpip3 install yaproxy
使用
HTTP代理
from yaproxy.HTTPProxyServer import HTTPProxy
p = HTTPProxy(listen_port=10080)
p.start()
HTTPS代理
from yaproxy.HTTPSProxyServer import HTTPSProxyServer
p = HTTPSProxyServer(listen_port=10443)
DNS代理
# 三种实现选择其一
# from yaproxy.DNSServer import DNSServer
# from yaproxy.DNSServerV2 import DNSServer
from yaproxy.GeventDNSServer import DNSServer
svr = DNSServer()
svr.set_hosts({b'abc': b'127.0.0.1'})
svr.start()
HTTP反向代理
from yaproxy.ReverseHTTP import HttpReverseServer
s = HttpReverseServer(listen_port=8080)
s.set_remote_server('www.gov.cn')
s.start()
TCP反向代理
from yaproxy.ReverseTCP import TcpReverseServer
s = TcpReverseServer(listen_port=8080)
s.set_remote_server('127.0.0.1', 22)
s.start()
相关资源
- toproxy 基于Tornado实现的HTTP代理服务器,支持HTTPS
Metadata
Release files for yaproxy 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yaproxy-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for yaproxy-0.0.1-py3-none-any.whl |
Release files / yaproxy-0.0.1-py3-none-any.whl
| Download URL | yaproxy-0.0.1-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e62667643ec525f2b199dfcd14204c64bd33db2fa6c9858528ca631617f06ac
|
|
BLAKE2b-256 checksum How to use checksums |
44c4d1d2dea4edcaf8f74adbcfb71a557c3540042731a21e727efb3072905add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
|
Security for yaproxy 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.