Yet Another Proxy
Project description
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-binary
pip3 install gevent
pip3 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
yaproxy-0.0.1-py3-none-any.whl
(14.9 kB
view details)
File details
Details for the file yaproxy-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: yaproxy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e62667643ec525f2b199dfcd14204c64bd33db2fa6c9858528ca631617f06ac |
|
MD5 | 7bab62de5d3f4494a0e3cbe4cc5dec72 |
|
BLAKE2b-256 | 44c4d1d2dea4edcaf8f74adbcfb71a557c3540042731a21e727efb3072905add |