Skip to content

Instantly share code, notes, and snippets.

@holmeszyx
Last active February 25, 2017 15:20
Show Gist options
  • Save holmeszyx/d1717e0ae76f4dddba60567b34f975b5 to your computer and use it in GitHub Desktop.
Save holmeszyx/d1717e0ae76f4dddba60567b34f975b5 to your computer and use it in GitHub Desktop.
KCP config file
{
"localaddr": "127.0.0.1:1090",
"remoteaddr": "server:3389",
"key": "",
"crypt": "salsa20",
"mode": "fast",
"conn": 1,
"autoexpire": 60,
"mtu": 1200,
"sndwnd": 1024,
"rcvwnd": 1024,
"datashard": 7,
"parityshard": 3,
"dscp": 46,
"nocomp": true,
"acknodelay": false,
"nodelay": 0,
"interval": 40,
"resend": 0,
"nc": 1,
"log": "kcp.log",
"snmplog": "kcp_snmp.log",
"snmpperiod": 60
}
{
"listen": "0.0.0.0:3389",
"target": "127.0.0.1:8080",
"key": "",
"crypt": "salsa20",
"mode": "fast",
"mtu": 1200,
"sndwnd": 1024,
"rcvwnd": 1024,
"datashard": 7,
"parityshard": 3,
"dscp": 46,
"nocomp": true,
"acknodelay": false,
"nodelay": 0,
"interval": 40,
"resend": 0,
"nc": 1,
"log": "kcp.log",
"snmplog": "kcp_snmp.log",
"snmpperiod": 60
}
#! /bin/bash
DIR="ss_dir"
SS="ss_bin"
kcpdir="kcp_dir"
kcp_server="kcp_server_address"
kcp_key="kcp_key"
kcp_crypt="salsa20"
do_kill() {
echo "Kill all shadowsocks clients"
p=$(pidof ${SS})
if [[ $p != "" ]]; then
echo "kill shadowsocks"
kill ${p}
fi
p=$(pidof ${kcpdir}/client_linux_amd64)
if [[ $p != "" ]]; then
echo "kill kcpclient"
kill ${p}
fi
}
do_kcp() {
echo "Start with kcp..."
nohup ${kcpdir}/client_linux_amd64 --l 127.0.0.1:1090 --r ${kcp_server} --key ${kcp_key} --crypt ${kcp_crypt} --nocomp --datashard 7 --parityshard 3 --conn 1 --mtu 1200 --sndwnd 1024 --rcvwnd 1024 --dscp 46 --mode fast > ${kcpdir}/kcp.log 2>&1 &
config=${DIR}/config.json.kcp
nohup ${SS} -c ${config} > ${DIR}/ss.log 2>&1 &
}
do_normal() {
echo "Start normal..."
config=${DIR}/config.json
nohup ${SS} -c ${config} > ${DIR}/ss.log 2>&1 &
}
do_record() {
echo "Done at $(date)" > done
}
do_help() {
echo "Usage: shadows {kill|kcp|help}"
}
cd ${DIR}
RET_VAL=0
case "$1" in
kill|kcp)
do_$1
;;
help)
do_help
;;
*)
do_normal
;;
esac
if [[ ${RET_VAL} -eq 0 ]]; then
do_record
fi
exit $RET_VAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment