Total Pageviews

Monday, 18 April 2016


My last blog talked about how to create a Socks 5 proxy with shadowsocks-nodejs and shadowsocks python version on iPhone,  well, they all work perfectly only that the nodejs version costs too much of  RAM and python version is a little bit slow, however, thanks to  , we got golang version of shadowsocks, it has the same speed(maybe better) with nodejs version but cost very little RAM, so i choose the golang version for my daily use and nodejs version as a backup. Okay, let's begin to install google go language and shadowsocks-go on iPhone,  i believe i am the first person to do this.

一篇博客介绍了如何在iPhone上利用shadowsocks-nodejs和Python版创建Socks 5代理,他们运行的很好,只是nodejs版本消耗内存太多而Python版因为缺少gevent而比较慢,还好有人开发了Go版的,它拥有nodejs版的速度,却只用少量的内存,所以我现在主要用Go版的,nodejs版的作为备用。下面就开始在iPhone上安装Google Go 的编译环境和并编译shadowsocks-go for iPhone,我应该是第一个这么做的吧 :)

If you want to be lazy, you can download compiled binary of shadowsocks-go client, it can only run inside  jailbreak iPhone, iPad and iPod Touch
果你想偷懒,可以直接下载我编译好的,只能在越狱的iPhone,iPad,iPod Touch上使用。

Install Google Golang on iPhone

  • SSH into iPhone and run the following command:


sudo dpkg -i go_15490_iphoneos-arm.deb

  • Now we have go languages installed, thanks +minux ma  for porting Golang to iOS, also thanks @trufae for making a working .deb package, they made it easy to install go on iPhone. However @trufae forgot to sign it's package, so we need to sign it after installation,
  • SSH into iPhone and run:

sudo apt-get install ldid
sudo ldid -s /var/go/bin/go
sudo ldid -s  /var/go/src/cmd/*
sudo ldid -s  /var/go/pkg/obj/cmd/* 

Config Google  Golang on iPhone

  • We need to add go to our PATH and also set GOPATH variable, GNU coreutils could help, it can set alias, PATH, export some variable and so.

mkdir ~/gosrc
sudo apt-get install coreutils

  • Next, we need to edit /etc/profile.d/ with vim or nano:

sudo vim /etc/profile.d/

  • Add the following codes and save:

export GOPATH="/var/mobile/gosrc"
export GOROOT="/var/go"
export PATH="/var/go/bin:$PATH"

  • Now make our settings on the fly:

source /etc/profile.d/ 

Compile Shadowsocks-go on iPhone

  • Download Shadowsocks-go source code and unzip it:

wget --no-check-certificate


  • We will have a  folder called shadowsocks-go-master at the current directory, now still need some trick:

mkdir -p ~/gosrc/src/

cp -r shadowsocks-go-master/shadowsocks ~/gosrc/src/

cd shadowsocks-go-master/cmd/shadowsocks-local/

go build

sudo cp shadowsocks-local /usr/bin/

  • If no mistake, now we will have a excutable shadowsocks-go client named shadowsocks-local in /usr/bin, we can run it now, only for iPhone.

Run Shadowsocks-go on iPhone

  • First  create a config file for shadowsocks-go:

cd ~
touch config.json
vim config.json

  • Copy and paste the following code and save


    "server":"your server ip or domain name",

    "password":"your password, make this password long and complex enough",

  • Also copy config.json to server, shadowsocks-go server version can be downloaded here:
  • on the server side:

nohup shadowsocks-server -c ~/config.json > /dev/null 2>&1 &

  • Or we can set an alias for this long command:

vim ~/.bashrc
alias sgp="nohup shadowsocks-server -c ~/config.json > /dev/null 2>&1 &"
source ~/.bashrc

  • on iPhone side:

nohup shadowsocks-local -c ~/config.json > /dev/null 2>&1 &

  • Or we can set an alias for this long command:

sudo vim /etc/profile.d/
alias sgp="nohup shadowsocks-local -c ~/config.json > /dev/null 2>&1 &"
source /etc/profile.d/

Create PAC file to use shadowsocks-go proxy on iPhone.