由于20-1大的原因,各种梯子损失惨重。自己也只好自己动手搭建VPS。关于如何搭建梯子这里暂不描述。

说明

下面的操作是建立在成功搭建VPS基础上

步骤

安装与配置polipo

安装polipo:

1
brew install polipo

在用户根目录创建或修改配置文件 .polipo,具体参考如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
proxyAddress = "0.0.0.0"
proxyPort = 8123
allowedClients = 127.0.0.1, 10.0.1.0/24
allowedPorts = 1-65535
tunnelAllowedPorts = 1-65535
proxyName = "localhost"
cacheIsShared = false
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
# chunkHighMark = 33554432
# diskCacheRoot = ""
# localDocumentRoot = ""
disableLocalInterface = true
disableConfiguration = true
dnsUseGethostbyname = yes
disableVia = true
censoredHeaders = from,accept-language,x-pad,link
censorReferer = maybe
# maxConnectionAge = 5m
# maxConnectionRequests = 120
# serverMaxSlots = 8
# serverSlots = 2

启动polipo:

1
2
3
brew services start polipo
brew services restart polipo 
brew services stop polipo    

查看代理端口

代理客户端使用Shadowsocks-NG-R8,它解决了一个长久以来的痛点,Shadowsocks没有HTTP代理,导致需要使用polipo等软件进行协议转换。

第一步:选择HTTP代理设置

第一步:选择HTTP代理设置

第二步:点击查看

第二步:点击查看

设置代理命令

vim打开vim ~/.bash_profile

在尾部添加如下内容:

1
2
alias proxy-on='export http_proxy=127.0.0.1:1087;export https_proxy=$http_proxy'
alias proxy-off='unset http_proxy;unset https_proxy'

修改立即生效: source ~/.bash_profile

测试

1
2
3
4
5
6
Michaels-iMac:~ eric$ proxy-on 
Michaels-iMac:~ eric$ go get -u google.golang.org/grpc   
package golang.org/x/net/context: golang.org/x/net is a custom import path for https://go.googlesource.com/net, but /Users/eric/go/src/golang.org/x/net is checked out from https://github.com/golang/net
package golang.org/x/net/http2: golang.org/x/net is a custom import path for https://go.googlesource.com/net, but /Users/eric/go/src/golang.org/x/net is checked out from https://github.com/golang/net
package golang.org/x/net/trace: golang.org/x/net is a custom import path for https://go.googlesource.com/net, but /Users/eric/go/src/golang.org/x/net is checked out from https://github.com/golang/net
package golang.org/x/net/http2/hpack: golang.org/x/net is a custom import path for https://go.googlesource.com/net, but /Users/eric/go/src/golang.org/x/net is checked out from https://github.com/golang/net

(end)