Total Pageviews

Friday 17 May 2013

搭建shadowsocks-go for android的服务器端(准原创文章)

首先在你的vps上搭建go环境。
如果你的vps是Ubuntu/Debian 系统,运行命令:

 # apt-get install bison ed gawk gcc libc6-dev make
 #  apt-get install mercurial   (如果是centos,则yum install mercurial)
# hg clone -r release https://go.googlecode.com/hg/ go
这样,当前目录下会生成go目录。并且源码将下载到该go目录内。
编译go环境: 
# cd go/src
# ./all.bash
编译完成后,结尾会打印以下信息:
Installed Go for linux/i386 in /root/go.(我的当前目录为/root)
Installed commands in /root/go/bin. 
这样go环境就搭建好了。(具体见http://briteming.blogspot.com/2013/05/linuxgo.html)
 
# cd  /root/go/bin/
# go get github.com/shadowsocks/shadowsocks-go/cmd/shadowsocks-server 
 这样在/root/go/bin/里面就会出现shadowsocks-server 文件,这是个执行文件。
as3:~/go/bin# ls
go  godoc  gofmt  shadowsocks-server (这里的go和
 shadowsocks-server都是可执行文件)
 as3:~/go/bin#  nano config.json (新建config.json文件,内容如下:

{
    "server":"your-hostname or ip",
    "server_port":9966,
    "local_port":1080,
    "method":"rc4",
    "password":"your-password",
    "timeout":600
}

上面的9966,1080可改为你自己设置的值。)
as3:~/go/bin# nohup shadowsocks-server -p 9966 -k your-password -t 600 -m rc4 -c config.json
 > /dev/null & 
(可以用ps aux|grep shadowsocks-server查看一下shadowsocks-server是否在运行。)
服务器端就搭建好了。 
 
记得添加如下命令到/etc/rc.local:
nohup /root/go/bin/shadowsocks-server -p 9966 -k your-password -t 600 -m rc4 -c /root/go/bin/config.json > /dev/null &
 
我们还可在~/go/bin/里新建第二个json文件:
as3:~/go/bin#  nano config2.json 
{
    "server":"your-hostname or ip",
    "server_port":9977,
    "local_port":1080,
    "method":"rc4",
    "password":"your-password2",
    "timeout":600
} 
然后
as3:~/go/bin# nohup /root/go/bin/shadowsocks-server -p 9977 -k your-password2 -t 600 -m rc4 -c /root/go/bin/config2.json > /dev/null & 
 
记得添加如下命令到/etc/rc.local:
nohup /root/go/bin/shadowsocks-server -p 9977 -k your-password2 -t 600 -m rc4 -c /root/go/bin/config2.json > /dev/null &  
  
这样通过不同的端口号和不同的key值,就建立了不同的shadowsocks-go帐号。至此你可以卖
shadowsocks-go帐号了。:-) 
 
下载安卓下的客户端程序:
https://github.com/shadowsocks/shadowsocks-android/releases/download/v2.10.3/shadowsocks-nightly-2.10.3.apk
到你的安卓手机进行安装。或:

Shadowsocks for Android

A shadowsocks client for Android, written in Scala.

Nightly Builds  
(from https://github.com/shadowsocks/shadowsocks-android)
 (参见http://briteming.blogspot.co.uk/2013/05/shadowsocks-go-for-androidvpn.html)
 该apk已内置shadowsocks-go帐号,你可用来翻墙。但毕竟是别人免费提供的帐号,哪天他
不提供服务了,你可把自己的帐号参数填进去,这样就可继续使用该app翻墙,真是很爽的app.
 项目地址:https://github.com/shadowsocks/shadowsocks-go
 
相关帖子 http://briteming.blogspot.co.uk/2013/02/shadowsocks-go.html 
-----------------------------------------------------
6



7



8



9



10



11



12



































--------------------------------------------------------------------

Centos6下,GO环境与shadowsocks-go的快速安装命令

 
又是长长的一行,复制粘贴就行.
export GOROOT=/usr/local/go && export GOPATH=/tools/go && export GOOS=linux && export GOARCH=386 && export GOBIN=$GOROOT/bin && export PATH=$PATH:$GOBIN && yum install gcc mercurial git make automake autoconf -y && hg clone -r release https://go.googlecode.com/hg/ $GOROOT && cd $GOROOT/src && ./all.bash && go get github.com/shadowsocks/shadowsocks-go/cmd/shadowsocks-server 运行结束之后执行 nohup /usr/local/go/bin/shadowsocks-server -c /yourconf.json & 就行,什么?yourconf.json找不到?自己Google去…
-------------------------------

ShadowSocks-go服务端一键安装脚本

 ShadowSocks-go服务端一键安装脚本,让大家配置自己的ShadowSocks私人账号,对于免费的ShadowSocks账号,本站也经常分享,但是如果用的人多了,那么不用说速度自然也就没有那么快了,那么我们有一个私人的ShadowSocks账号,自己独享岂不是更好?

ShadowSocks目前大多网友都在使用,它有libev和python服务端,但是经过我们的使用发现目前go版本现有版本中最好用的一个版本,它主要是在我们的一些低配置的VPS上可以发出很好的效果。
安装方法

系统要求:CentOS 6.X及以上 32 or 64bit

内存要求:96M以上(这个不包括96M,太小的内存无法使用,切记)

主机要求:纯净系统(在我们准备安装之前最好rebuild系统一次)

脚本语言:go版

首先我们登录Root账号然后输入以下命令:  
wget --no-check-certificate http://7sbp7c.com1.z0.glb.clouddn.com/shadowsocks-go.sh
chmod +x shadowsocks-go.sh
./shadowsocks-go.sh 2>&1 | tee shadowsocks-go.log

然后我们根据提示信息输入“SS密码”回车运行,如果我们不设置密码那么我们的shadowsocks账号默认密码是abclite,当我们完成安装后系统会有以下提示:
Congratulations, shadowsocks install completed!
Your Server IP:your_server_ip
Your Server Port:443
Your Password:
Your Encryption Method:rc4-md5

上面的信息依次为:
服务器地址:your_server_ip
服务器端口:443
密码:
加密方式:rc4-md5

下面给大家介绍下后期维护的一些命令:

卸载:  
./shadowsocks-go.sh uninstall

修改参数:  
vi /etc/shadowsocks.json

启动:  
/etc/init.d/shadowsocks start

停止:  
/etc/init.d/shadowsocks stop

重启:  
/etc/init.d/shadowsocks restart

查看状态:
/etc/init.d/shadowsocks status

注意事项
当我们成功安装脚本以后都是以开机自启形式运行,当服务器重启后自动运行;
我们安装的脚本是官方的最新版本,假如官方有新版本发布时,请大家卸载后重装一次即可。
对于加密方式我们是可以随意修改的,如果大家要修改加密方式为aes-256-fcb,那么我们直接用VIM命令:vi /etc/shadowsocks.json进行修改,然后重启ShadowSocks即可;
如果我们的服务器是openVZ那么就不用再进行优化.
go版本与python版本相比内存占用较大,因为服务器并发数处理原因,内存低于128M的VPS就不要安装了,在小内存VPS上安装后内存不够用会自动kill进程,导致提示remove pid无法使用,小内存建议使用ShadowSocks-python服务端一键安装脚本.
====================

Shadowsocks-go一键安装脚本


 与 python 版不同的是,其客户端程序能使用多个服务端配置,本脚本安装的是服务端程序。作者默认推荐 aes-128-cfb 加密,基于一致性,脚本使用了 aes-256-cfb 加密方式。

默认配置:
服务器端口:自己设定(如不设定,默认为 8989)
客户端端口:1080
密码:自己设定

客户端下载:
http://sourceforge.net/projects/shadowsocksgui/files/dist/

使用方法:
使用root用户登录,运行以下命令:

wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-go.sh
chmod +x shadowsocks-go.sh
./shadowsocks-go.sh 2>&1 | tee shadowsocks-go.log

安装完成后,脚本提示如下:

Congratulations, shadowsocks-go install completed!
Your Server IP:your_server_ip
Your Server Port:your_server_port
Your Password:your_password
Your Local Port:1080
Your Encryption Method:aes-256-cfb
Enjoy it!

卸载方法:
使用 root 用户登录,运行以下命令:
./shadowsocks-go.sh uninstall


安装完成后,即已后台启动shadowsocks-go ,运行:
/etc/init.d/shadowsocks status
可以查看 shadowsocks-go 进程是否已经启动。
本脚本安装完成后,已将 shadowsocks-go 加入开机自启动。

使用命令:
启动:/etc/init.d/shadowsocks start
停止:/etc/init.d/shadowsocks stop
重启:/etc/init.d/shadowsocks restart
状态:/etc/init.d/shadowsocks status

多用户多端口配置文件 sample:
配置文件路径:/etc/shadowsocks/config.json

{
    "port_password":{
         "8989":"password0",
         "9001":"password1",
         "9002":"password2",
         "9003":"password3",
         "9004":"password4"
    },
    "method":"aes-256-cfb",
    "timeout":600
}

官方版本的 sample ,详见这里-https://github.com/shadowsocks/shadowsocks-go/blob/master/sample-config/server-multi-port.json

相关帖子:
http://briteming.blogspot.com/2013/02/shadowsocks-go.html