snell-server

conf配置

[snell-server]
listen = 0.0.0.0:9090
psk = test2020
obfs = tls

启动 snell-server -c snell.server.conf

Surge客户端配置

Proxy = snell, [SERVER ADDRESS], [GENERATED PORT], psk=[GENERATED PSK], obfs=[http/tls]
填入:Proxy =snell,8.8.8.8,9090,psk=test2020,obfs=tls

需求

安装snell-server后,需要在centos中使用...
相当于... 某个地方整了一个snell-server,然后我要在另外一个地方整一个snell-client,并且配置指定范围的域名走client,其它的就不走...

第一步. 测试snell的socks5是否有效

curl --socks5 127.0.0.1:1080 http://httpbin.org/ip
这时候返回的如果是snell-server的ip表示服务是正常的

第二步. 安装 privoxy

sudo yum install -y privoxy

privoxy 的配置目录在文件夹/etc/privoxy下。
进入目录/etc/privoxy,可以看到目录结构大致为:

  • config 配置文件,这个文件很长。。
  • *.action 代理规则文件
  • *.filter 过滤规则文件

第三步 gfwlist生成配置文件

apt-get intall python-pip
pip install gfwlist2privoxy

wget https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt
gfwlist2privoxy -i gfwlist.txt -f /etc/privoxy/gfwlist.action -p 127.0.0.1:1234 -t socks5

运行后便生成一个 gfwlist.action,在 privoxy 里将其配置进去即可。

sudo vi /etc/privoxy/config
# 搜索 socks5t在下面添加一条转发代理ip ,存在则去掉注释即可
forward-socks5t   /               127.0.0.1:1234 .
# 搜索listen-address,取消注释的ip地址,或者直接新加下面的信息
listen-address  127.0.0.1:8118

actionsfile gfwlist.action

配置pac.action

pac.action内容

{{alias}}
direct      = +forward-override{forward .}
gae         = +forward-override{forward-socks5 127.0.0.1:1234 .}
default     = direct

{default}
/

{direct} 
.cn

{gae}
.httpbin.org
.github.com

增加配置进config

pac pac.action

写入命令行proxy

vim ~/.bashrc
# 加入以下内容,如想关闭全局代理,则注释掉
export http_proxy=http://127.0.0.1:8118  
export https_proxy=http://127.0.0.1:8118  
# 更新配置
source ~/.bashrc

开启服务

systemctl enable privoxy
systemctl start privoxy

测试

现在访问curl http://httpbin.org/ip应该显示是server,而curl ipinfo.io 应该显示的client的IP,如果是正常,表示配置OK

git配置proxy

git config --global http.proxy socks5://127.0.0.1:1234
git config --global https.proxy socks5://127.0.0.1:1234