Pages

Tuesday, 31 December 2019

又一款可以套上一层socks proxy的dns代理程序-anotherproxy

先挂个vpn,然后,
cd $GOPATH
go get -u -v github.com/zeroshirts/anotherproxy/
which anotherproxy
没有显示内容。说明以上的操作还不够,还需:
cd src/github.com/zeroshirts/anotherproxy/
go build
(在当前目录下,会生成可执行文件anotherproxy)
cp anotherproxy /usr/local/bin/
which anotherproxy
显示:
/usr/local/bin/anotherproxy
因此,可以直接运行anotherproxy了。
anotherproxy -h
显示:
Usage of anotherproxy:
  -alsologtostderr
    log to standard error as well as files
  -httpproxy string
    Address:port for local HTTP proxy (default "127.0.0.1:8080")
  -localdns string
    Address:port for local DNS requests (default "127.0.0.1:53")
  -log_backtrace_at value
    when logging hits line file:N, emit a stack trace
  -log_dir string
    If non-empty, write log files in this directory
  -logtostderr
    log to standard error instead of files
  -remotedns string
    Address:port of upstream DNS servers (comma seperated for multiple values) (default "8.8.8.8:53,8.8.4.4:53")
  -socks5 string
    SOCKS5 address:port
  -stderrthreshold value
    logs at or above this threshold go to stderr
  -v value
    log level for V logs
  -vmodule value

     comma-separated list of pattern=N settings for file-filtered logging


所以,
cd ~
sudo anotherproxy -localdns 127.0.0.1:53 -remotedns "8.8.8.8:53,8.8.4.4:53" -socks5 127.0.0.1:1080
(你需先运行一个本地的socks proxy,比如ss客户端)

实际使用例子:
sudo wg-quick up wg0

sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
(在运行完wg命令后,等2分钟才运行本命令,方能成功修改本机的dns server地址为127.0.0.1)

sudo anotherproxy -localdns 127.0.0.1:53 -remotedns "8.8.8.8:53,8.8.4.4:53" -socks5 127.0.0.1:1080

项目地址:https://github.com/zeroshirts/anotherproxy