一、/Users/humorhan/Documents/myhankan/lightproxy
有关pac代理的实现。
代码路径: https://github.com/octavore/lightproxy
二、/Users/humorhan/Documents/myhankan/lightsocks
有关socks5代理。150行实现:https://github.com/qq827435393/sampleSocks5Proxy
代码路径:https://github.com/gwuhaolin/lightsocks
-
编译:
- go build -a -installsuffix cgo -o lightsocks-local ./cmd/lightsocks-local
- go build -a -installsuffix cgo -o lightsocks-server ./cmd/lightsocks-server
-
运行:
- 先运行server
- 修改/Users/humorhan/.lightsocks.json,运行local
-
代理验证:
- curl –proxy “socks://127.0.0.1:1080” https://www.baidu.com
-
其它可参考代码:
3、benchmark 性能测试,支持socks5 、http
Building
go get github.com/cnlh/benchmark
Usage
benchmark [flags] url
with the flags being
-b string
the body of request
-c int
the number of connection (default 1000)
-cpu int
the number of cpu used
-h string
request header, split by \r\n
-host string
the host of request
-m string
request method (default "GET")
-n int
the number of request (default 100000)
-t int
request/socket timeout in ms (default 3000)
-proxy string
proxy of request
for example
benchmark -c 1100 -n 1000000 http://127.0.0.1/
benchmark -c 1100 -n 1000000 -proxy http://111:222@127.0.0.1:1235 http://127.0.0.1/
benchmark -c 1100 -n 1000000 -proxy socks5://111:222@127.0.0.1:1235 http://127.0.0.1/
benchmark -c 1100 -n 1000000 -h "Connection: close\r\nCache-Control: no-cache" http://127.0.0.1/
...