Psiphon3 命令行版本编译指南

源码: Psiphon 3 Tunnel Core 项目
编译:
原项目中关于编译说的比较简单笼统,这里详细说下。
首先确认 Go 编译环境已经安装好,可以参考 Tomatoware ARM 下建立 Go 编译环境 一文。
然后要下载一些依赖及源程序:
go get -v github.com/Psiphon-Inc/bolt 
go get -v github.com/Psiphon-Inc/dns 
go get -v github.com/Psiphon-Inc/goptlib 
go get -v github.com/Psiphon-Inc/goregen 
go get -v github.com/Psiphon-Inc/ratelimit 
go get -v github.com/Psiphon-Labs/psiphon-tunnel-core
写个编译脚本:

#!/bin/sh
WORKDIR=$(pwd)
cd src/github.com/Psiphon-Labs/psiphon-tunnel-core
BUILDDATE=$(date --iso-8601=seconds)
BUILDREPO=$(git config --get remote.origin.url)
BUILDREV=$(git rev-parse --short HEAD)
GOVERSION=$(go version | perl -ne '/go version (.*?) / && print $1')
LDFLAGS="
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildDate=$BUILDDATE
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRepo=$BUILDREPO
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRev=$BUILDREV
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.goVersion=$GOVERSION
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.gomobileVersion=$GOVERSION
"
cd ConsoleClient && go build -ldflags "${LDFLAGS}"
mv -f ./ConsoleClient ${WORKDIR}/bin/psiphon-tunnel-core-$BUILDREV
cd ${WORKDIR}
strip bin/psiphon-tunnel-core-$BUILDREV
upx -9 bin/psiphon-tunnel-core-$BUILDREV
bin/psiphon-tunnel-core-$BUILDREV

命令行运行:
./psiphon-tunnel-core -config ./psiphon.config -serverList ./server_list.dat -listenInterface br0 -formatNotices
psiphon.config 以及 server_list.dat 文件可以从 Windows 版本的 Psiphon3 (赛风3) 安装版本中提取。
运行结果:
psiphon-tunnel-core: Starting psiphon-tunnel-core...
2016-10-12T02:52:38Z BuildInfo {"buildDate":"2016-09-27T16:28:36+08:00","buildRepo":"https://github.com/Psiphon-Labs/psiphon-tunnel-core","buildRev":"31dad76","goVersion":"go1.6","gomobileVersion":"go1.6"}
2016-10-12T02:52:38Z AvailableEgressRegions {"regions":["CA","DE","GB","IN","JP","NL","SG","US"]}
2016-10-12T02:52:38Z ListeningSocksProxyPort {"port":7788}
2016-10-12T02:52:38Z ListeningHttpProxyPort {"port":8788}
2016-10-12T02:52:38Z ImpairedProtocolClassification {"classification":{}}
2016-10-12T02:52:38Z CandidateServers {"count":153,"protocol":"","region":""}
2016-10-12T02:52:42Z Homepage {"url":"http://www.psiphontoday.com/zh/index_desktop.html?client_region=CN"}
2016-10-12T02:52:42Z ClientUpgradeAvailable {"version":"116"}
2016-10-12T02:52:42Z Tunnels {"count":1}
出现 Tunnels {"count":1} 字样就表示连接服务器成功了。
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.