macOS 不像 Windows 平台那樣有多種多樣的翻牆工具,通常情況下在 macOS 下翻牆採用 VPN、SS、SSR 等協議,而最近又發生很多事情,如:VPN 被協議封鎖、SS 被探測、SSR 停止更新等,所以我們需要一個備用的翻牆方式。賽風(Psiphon)是一個老牌的翻牆軟件,一般用來瀏覽網頁沒有什麼問題。雖然 Psiphon 並沒有官方支持 macOS,但是我們仍然可以編譯並使用 Psiphon。
安裝 Golang 編譯器:
由於 Psiphon 是使用 Golang 寫成的,所以你需要安裝 Golang。
打開 Golang 的下載頁面並下載 Apple macOS 包,之後安裝。
安裝 Homebrew:
Homebrew 是 macOS 下一個很好用的軟件包安裝工具,需要安裝以使用 git 命令。
在 Terminal 中執行:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
獲取 Psiphon 源代碼:
在 Terminal 中執行:
git clone https://github.com/Psiphon-Labs/psiphon-tunnel-core.git
編譯 Psiphon:
在上一步中獲取到了 Psiphon 的源代碼,在執行上一個命令的文件夾中進入 Psiphon 編譯器目錄。
cd psiphon-tunnel-core/ConsoleClient
由於 Psiphon 的編譯腳本在 macOS 下有一些 bug,所以需要手動修改一些參數,打開編輯器修改 make.bash 文件。
我比較喜歡用 nano 編輯器,所以執行:
nano make.bash
找到這一行:
BUILDDATE=$(date --iso-8601=seconds)
修改為:
BUILDDATE=$(date +%Y-%m-%dT%H:%M:%S%z)
之後執行:
./make.bash osx
然後進行等待,等待的時常根據你的網速有關,因為需要進行 git 獲取一些必要的組件。
在等待大概 10 分鐘後,編譯已經完成。
配置與運行 Psiphon:
進入編譯好的 psiphon 目錄
cd bin/darwin/
建立一個 config.json 文件並輸入以下內容,這個配置文件包含了一些必要的參數,如:Psiphon 服務器列表的公鑰等⋯(更新于 2018 年 8 月 26 日)
{
"DeviceRegion":"US",
"EgressRegion":"",
"LocalHttpProxyPort":8081,
"LocalSocksProxyPort":1081,
"NetworkID":"949F2E962ED7A9165B81E977A3B4758B",
"ObfuscatedServerListDownloadDirectory":"osl",
"ObfuscatedServerListRootURLs":[{"OnlyAfterAttempts":0,
"SkipVerify":false,
"URL":"aHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3BzaXBob24vd2ViL21qcjQtcDIzci1wdXdsL29zbA=="},
{"OnlyAfterAttempts":2,
"SkipVerify":true,
"URL":"aHR0cHM6Ly93d3cuc3RvcmFnZWpzc3RyYXRlZ2llc2ZhYnVsb3VzLmNvbS93ZWIvbWpyNC1wMjNyLXB1d2wvb3Ns"},
{"OnlyAfterAttempts":2,
"SkipVerify":true,
"URL":"aHR0cHM6Ly93d3cuYnJhbmRpbmd1c2FnYW1lcmVwLmNvbS93ZWIvbWpyNC1wMjNyLXB1d2wvb3Ns"},
{"OnlyAfterAttempts":2,
"SkipVerify":true,
"URL":"aHR0cHM6Ly93d3cueHlkaWFtb25kZGJleHBlcnQuY29tL3dlYi9tanI0LXAyM3ItcHV3bC9vc2w="}],
"PropagationChannelId":"92AACC5BABE0944C",
"RemoteServerListDownloadFilename":"remote_server_list",
"RemoteServerListSignaturePublicKey":"MIICIDANBgkqhkiG9w0BAQEFAAOCAg0AMIICCAKCAgEAt7Ls+/39r+T6zNW7GiVpJfzq/xvL9SBH5rIFnk0RXYEYavax3WS6HOD35eTAqn8AniOwiH+DOkvgSKF2caqk/y1dfq47Pdymtwzp9ikpB1C5OfAysXzBiwVJlCdajBKvBZDerV1cMvRzCKvKwRmvDmHgphQQ7WfXIGbRbmmk6opMBh3roE42KcotLFtqp0RRwLtcBRNtCdsrVsjiI1Lqz/lH+T61sGjSjQ3CHMuZYSQJZo/KrvzgQXpkaCTdbObxHqb6/+i1qaVOfEsvjoiyzTxJADvSytVtcTjijhPEV6XskJVHE1Zgl+7rATr/pDQkw6DPCNBS1+Y6fy7GstZALQXwEDN/qhQI9kWkHijT8ns+i1vGg00Mk/6J75arLhqcodWsdeG/M/moWgqQAnlZAGVtJI1OgeF5fsPpXu4kctOfuZlGjVZXQNW34aOzm8r8S0eVZitPlbhcPiR4gT/aSMz/wd8lZlzZYsje/Jr8u/YtlwjjreZrGRmG8KMOzukV3lLmMppXFMvl4bxv6YFEmIuTsOhbLTwFgh7KYNjodLj/LsqRVfwz31PgWQFTEPICV7GCvgVlPRxnofqKSjgTWI4mxDhBpVcATvaoBl1L/6WLbFvBsoAUBItWwctO2xalKxF5szhGm8lccoc5MZr8kfE0uxMgsxz4er68iCID+rsCAQM=",
"RemoteServerListURLs":[{"OnlyAfterAttempts":0,
"SkipVerify":false,
"URL":"aHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3BzaXBob24vd2ViL21qcjQtcDIzci1wdXdsL3NlcnZlcl9saXN0X2NvbXByZXNzZWQ="},
{"OnlyAfterAttempts":2,
"SkipVerify":true,
"URL":"aHR0cHM6Ly93d3cuc3RvcmFnZWpzc3RyYXRlZ2llc2ZhYnVsb3VzLmNvbS93ZWIvbWpyNC1wMjNyLXB1d2wvc2VydmVyX2xpc3RfY29tcHJlc3NlZA=="},
{"OnlyAfterAttempts":2,
"SkipVerify":true,
"URL":"aHR0cHM6Ly93d3cuYnJhbmRpbmd1c2FnYW1lcmVwLmNvbS93ZWIvbWpyNC1wMjNyLXB1d2wvc2VydmVyX2xpc3RfY29tcHJlc3NlZA=="},
{"OnlyAfterAttempts":2,
"SkipVerify":true,
"URL":"aHR0cHM6Ly93d3cueHlkaWFtb25kZGJleHBlcnQuY29tL3dlYi9tanI0LXAyM3ItcHV3bC9zZXJ2ZXJfbGlzdF9jb21wcmVzc2Vk"}],
"SponsorId":"1BC527D3D09985CF",
"UseIndistinguishableTLS":true}
妳可以在這裡看到完整的配置參數,如指定使用某國家服務器等。
然後妳就可以運行啦,執行:
./psiphon-tunnel-core-x86_64 -config config.json
在成功獲取到服務器位置列表(regions)後(如下圖),賽風就配置完成啦!
設置瀏覽器:
將代理設置為:
SOCKS5: 127.0.0.1:1081
或
HTTP(S): 127.0.0.1:8081
在2016macbook pro 下命令 ./psiphon-tunnel-core-x86_64 -config config.json
没反应?
试试
./psiphon-tunnel-core-x86_64 -v
看看有没有什么显示?如果有显示的话把
-config
改成--config
。WordPress 程序会自动把两个 dash 转化成一个。
运行./make.bash osx
显示:
“No UPX for this build”
“No UPX for this build”是什么意思?
UPX 是一种压缩算法,一般是给 Windows 下的 EXE 用的。
hello.
yudeMacBook-Air:ConsoleClient brite$ ./make.bash osx
+ ‘[‘ ‘!’ -f make.bash ‘]’
+ EXE_BASENAME=psiphon-tunnel-core
+ PRIVATE_PLUGINS_TAG=
+ BUILD_TAGS=
+ WINDOWS_BUILD_TAGS=
+ LINUX_BUILD_TAGS=
+ OSX_BUILD_TAGS=
+ ‘[‘ ‘!’ -d bin ‘]’
+ mkdir bin
+ TARGET=osx
+ case $TARGET in
+ echo ‘..Building for OSX’
..Building for OSX
+ build_for_osx
+ echo ‘Getting project dependencies (via go get) for OSX’
Getting project dependencies (via go get) for OSX
+ GOOS=darwin
+ go get -d -v -tags ” ./…
github.com/Psiphon-Labs/psiphon-tunnel-core (download)
# cd /Users/yuming/go1.10.2/go/gopath/src/github.com/Psiphon-Labs/psiphon-tunnel-core; git pull –ff-only
From https://github.com/Psiphon-Labs/psiphon-tunnel-core
6f115fc..0d59f0a master -> origin/master
f234cac..8e56c66 staging-client -> origin/staging-client
d9ce03b..39f889d staging-server -> origin/staging-server
* [new tag] library-v1.0.4 -> library-v1.0.4
* [new tag] v1.0.5 -> v1.0.5
* [new tag] v1.0.6 -> v1.0.6
error: Your local changes to the following files would be overwritten by merge:
ConsoleClient/make.bash
Please, commit your changes or stash them before you can merge.
Aborting
Updating 6f115fc..0d59f0a
package github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/parameters: exit status 1
yudeMacBook-Air:ConsoleClient brite$
遇错,怎么解决?
我这里试了下,可以的,请确认完全按照文章的步骤重新来一遍。
注意安装 Golang 编译器,以及 Homebrew。
正常输出如下:
localhost:Downloads user$ git clone https://github.com/Psiphon-Labs/psiphon-tunnel-core.git
Cloning into 'psiphon-tunnel-core'...
remote: Counting objects: 15358, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 15358 (delta 10), reused 11 (delta 6), pack-reused 15338
Receiving objects: 100% (15358/15358), 52.33 MiB | 1.36 MiB/s, done.
Resolving deltas: 100% (9747/9747), done.
localhost:Downloads user$ cd psiphon-tunnel-core/ConsoleClient
localhost:ConsoleClient user$ ./make.bash osx
+ '[' '!' -f make.bash ']'
+ EXE_BASENAME=psiphon-tunnel-core
+ PRIVATE_PLUGINS_TAG=
+ BUILD_TAGS=
+ WINDOWS_BUILD_TAGS=
+ LINUX_BUILD_TAGS=
+ OSX_BUILD_TAGS=
+ '[' '!' -d bin ']'
+ mkdir bin
+ TARGET=osx
+ case $TARGET in
+ echo '..Building for OSX'
..Building for OSX
+ build_for_osx
+ echo 'Getting project dependencies (via go get) for OSX'
Getting project dependencies (via go get) for OSX
+ GOOS=darwin
+ go get -d -v -tags '' ./...
github.com/Psiphon-Labs/psiphon-tunnel-core (download)
created GOPATH=/Users/user/go; see 'go help gopath'
+ prepare_build ''
+ BUILDINFOFILE=psiphon-tunnel-core_buildinfo.txt
++ date --iso-8601=seconds
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
+ BUILDDATE=
localhost:ConsoleClient user$ nano make.bash
localhost:ConsoleClient user$ ./make.bash osx
+ '[' '!' -f make.bash ']'
+ EXE_BASENAME=psiphon-tunnel-core
+ PRIVATE_PLUGINS_TAG=
+ BUILD_TAGS=
+ WINDOWS_BUILD_TAGS=
+ LINUX_BUILD_TAGS=
+ OSX_BUILD_TAGS=
+ '[' '!' -d bin ']'
+ TARGET=osx
+ case $TARGET in
+ echo '..Building for OSX'
..Building for OSX
+ build_for_osx
+ echo 'Getting project dependencies (via go get) for OSX'
Getting project dependencies (via go get) for OSX
+ GOOS=darwin
+ go get -d -v -tags '' ./...
+ prepare_build ''
+ BUILDINFOFILE=psiphon-tunnel-core_buildinfo.txt
++ date +%Y-%m-%dT%H:%M:%S%z
+ BUILDDATE=2018-07-29T03:28:29-0700
++ git config --get remote.origin.url
+ BUILDREPO=https://github.com/Psiphon-Labs/psiphon-tunnel-core.git
++ git rev-parse --short HEAD
+ BUILDREV=0d59f0a
++ go version
++ perl -ne '/go version (.*?) / && print $1'
+ GOVERSION=go1.10.3
++ echo -n '{'
++ go list -tags '' -f '{{range $dep := .Deps}}{{printf "%s\n" $dep}}{{end}}'
++ xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
++ xargs -I pkg bash -c 'cd $GOPATH/src/pkg && echo -n "\"pkg\":\"$(git rev-parse --short HEAD)\","'
++ sed 's/,$/}/'
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/curve25519: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/ed25519: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/ed25519/internal/edwards25519: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/nacl/box: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/nacl/secretbox: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/poly1305: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/salsa20/salsa: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/ssh: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/obfuscator: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/osl: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/parameters: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/quic: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/sss: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/tactics: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/tun: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/wildcard: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/transferstats: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/upstreamproxy: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/upstreamproxy/go-ntlm/ntlm: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/upstreamproxy/go-ntlm/ntlm/md4: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/Psiphon-Labs/bolt: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/Psiphon-Labs/dns: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/Psiphon-Labs/goarista/monotime: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/Psiphon-Labs/goptlib: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/Psiphon-Labs/utls: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/Psiphon-Labs/utls/cipherhw: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/bifurcation/mint: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/bifurcation/mint/syntax: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/cheekybits/genny/generic: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/creack/goselect: No such file or directory
bash: line 0: cd: /src/github.com/Psiphon-Labs/psiphon-tunnel-core/vendor/github.com/grafov/m3u8: No such file or directory
省略。。。。
mkdir -p bin/darwin/
mv $WORK/b001/exe/a.out bin/darwin/psiphon-tunnel-core-x86_64
rm -r $WORK/b001/
+ echo '..No UPX for this build'
..No UPX for this build
+ exit 0
localhost:ConsoleClient user$ cd bin/darwin/
localhost:darwin user$ ls -al
total 32496
drwxr-xr-x 3 user staff 102 Jul 29 03:28 .
drwxr-xr-x 3 user staff 102 Jul 29 03:28 ..
-rwxr-xr-x 1 user staff 16636432 Jul 29 03:28 psiphon-tunnel-core-x86_64
localhost:darwin user$ ./psiphon-tunnel-core-x86_64
{"data":{"message":"configuration file is required"},"noticeType":"Error","showUser":false,"timestamp":"2018-07-29T10:31:57.832Z"}
localhost:darwin user$
还是搞不定,可否把mac上的可执行文件psiphon-tunnel-core-x86_64上传到你的github
账号的releases下,提供下载呢?
好的呢。
https://github.com/yanderemoe/psi4mac/blob/master/psiphon-tunnel-core-x86_64-macos
SHA-512 校验:1a72322afd5c5e7e912ad557870bdd809ef9b2f6a4d1b36a3e7561db5804f40a8330886ef12a9509c97806414d093192f9d70c5360a213101e06c5e1e1b8a340
bogon:~ brite$ nano psiphon-config.json
bogon:~ brite$ ./psiphon-tunnel-core-x86_64-macos -config psiphon-config.json
{“data”:{“port”:1081},”noticeType”:”ListeningSocksProxyPort”,”showUser”:false,”timestamp”:”2018-08-19T17:23:22.775Z”}
{“data”:{“port”:8081},”noticeType”:”ListeningHttpProxyPort”,”showUser”:false,”timestamp”:”2018-08-19T17:23:22.776Z”}
將浏览器的代理設置為:
SOCKS5: 127.0.0.1:1081
翻墙失败。怎么解决?
尝试下文章中最新的配置文件(config.json)呢?可能是 Psiphon 已经更新了配置文件格式或参数呢。
在哪里可以下载最新的config.json文件呢
可以从 Windows 版的 Psiphon 中提取,具体方法是在 %APPDATA% 目录中找到 Psiphon,然后复制出 config 文件。
its too complicated can u make some .dmg file 1 click run?