Install shadowsocksr on FreeBSD 11

cd /usr/local
git clone -b manyuser https://github.com/shadowsocksr-backup/shadowsocksr.git
cd /usr/local/shadowsocksr
bash /usr/local/shadowsocksr/initcfg.sh
mkdir /usr/local/etc/shadowsocksr
vi /usr/local/etc/shadowsocksr/user-config.json
{
    "server": "0.0.0.0",
    "server_port": 54321,
    "local_address": "127.0.0.1",
    "local_port": 1080,

    "password": "jason-tang.com",
    "method": "chacha20-ietf",
    "protocol": "auth_sha1_v4_compatible",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth_compatible",
    "obfs_param": "",
    "speed_limit_per_con": 0,
    "speed_limit_per_user": 0,

    "additional_ports" : {}, // only works under multi-user mode
    "additional_ports_only" : false, // only works under multi-user mode
    "timeout": 120,
    "udp_timeout": 60,
    "dns_ipv6": false,
    "connect_verbose_info": 0,
    "redirect": "",
    "fast_open": false
}

vi /usr/local/etc/rc.d/shadowsocksr
#!/bin/sh

# PROVIDE: shadowsocksr
# REQUIRE: DAEMON
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable shadowsocksr:
# shadowsocksr_enable (bool):  Set to "NO" by default.
#      Set to "YES" to enable shadowsocksr.
# shadowsocksr_config (path): Shadowsocksr config file.
#      Defaults to "/usr/local/etc/shadowsocksr/user-config.json"


. /etc/rc.subr

name="shadowsocksr"
rcvar=shadowsocksr_enable


load_rc_config $name

: ${shadowsocksr_enable:="NO"}
: ${shadowsocksr_config="/usr/local/etc/shadowsocksr/user-config.json"}

command="/usr/local/bin/python"
pidfile="/var/run/shadowsocksr.pid"
required_files="${shadowsocksr_config}"

command_args=" /usr/local/shadowsocksr/shadowsocks/server.py -c $shadowsocksr_config -d start"

run_rc_command "$1"


chmod 555 /usr/local/etc/rc.d/shadowsocksr

vi /etc/rc.conf
shadowsocksr_enable="YES"

/usr/local/etc/rc.d/shadowsocksr start