因为种种原因,自己的几个ss/ssr服务基本都失联了,最近被推荐了kcptun,原来觉得kcptun只是用于加速,没想到由于它本身的设计,现在居然可以用于绕过高墙。
一、服务端
首先配置ss:
$ pip install shadowsocks # 如果安完之后找不到ssserver,sudo之后可以解决;
$ ssserver -p [SS_PORT] -k [SS_KEY] -m [ENRYPT_METHOD] --user nobody -d start
$ wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
$ tar zxf LATEST.tar.gz
$ cd libsodium-stable
$ ./configure
$ sudo make && sudo make install
如果依然报错,su之后;
$ echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
$ ldconfig
然后配置kcptun:
$ wget https://raw.githubusercontent.com/kuoruan/kcptun_installer/master/kcptun.sh
$ chmod +x ./kcptun.sh
$ ./kcp.sh
二、客户端
1.CLI
以MacOS下为例: 从原repo的releases页https://github.com/xtaci/kcptun/releases 获取kcptun的可执行文件
$ ./client_darwin_amd64 --help
NAME:
kcptun - client(with SMUX)
USAGE:
client_darwin_amd64 [global options] command [command options] [arguments...]
VERSION:
20190109
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--localaddr value, -l value local listen address (default: ":12948")
--remoteaddr value, -r value kcp server address (default: "vps:29900")
--key value pre-shared secret between client and server (default: "it's a secrect") [$KCPTUN_KEY]
--crypt value aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none (default: "aes")
--mode value profiles: fast3, fast2, fast, normal, manual (default: "fast")
--conn value set num of UDP connections to server (default: 1)
--autoexpire value set auto expiration time(in seconds) for a single UDP connection, 0 to disable (default: 0)
--scavengettl value set how long an expired connection can live(in sec), -1 to disable (default: 600)
--mtu value set maximum transmission unit for UDP packets (default: 1350)
--sndwnd value set send window size(num of packets) (default: 128)
--rcvwnd value set receive window size(num of packets) (default: 512)
--datashard value, --ds value set reed-solomon erasure coding - datashard (default: 10)
--parityshard value, --ps value set reed-solomon erasure coding - parityshard (default: 3)
--dscp value set DSCP(6bit) (default: 0)
--nocomp disable compression
--sockbuf value per-socket buffer in bytes (default: 4194304)
--keepalive value seconds between heartbeats (default: 10)
--snmplog value collect snmp to file, aware of timeformat in golang, like: ./snmp-20060102.log
--snmpperiod value snmp collect period, in seconds (default: 60)
--log value specify a log file to output, default goes to stderr
--quiet to suppress the 'stream open/close' messages
-c value config from json file, which will override the command from shell
--help, -h show help
--version, -v print the version
$ ./client_darwin_amd64 -l :xxx -r xx.xx.xx.xx:xxxxx --key xxxx --crypt xxxx --mode xxxx
2.Windows GUI
在GUI客户端中进行配置,如图: 配置完成点击启动;
然后在Shadowsocsk的客户端中添加一个新的服务器,ip填127.0.0.1,端口填上面的“本地侦听端口”,其他参数与服务端的ss配置一致,配置完成启动即可;
3.Android
在Play Store中下载Shadowsocks和kcptun,在Shadowsocks中填加一个新的服务器配置,ip填服务器ip,端口填服务端的kcp端口,其他和ss配置一致,在下方的Plugin设置中选择kcptun,参数仿照默认格式填写即可;