mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-04 00:53:41 +00:00
enable TCP_NODELAY from config file (#1757)
* Fix #1739 Refine #1739 * enable TCP_NODELAY from config file
This commit is contained in:
@@ -93,3 +93,6 @@ doc/*.html
|
||||
*.tar.gz
|
||||
*.tgz
|
||||
#
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
|
||||
@@ -184,7 +184,7 @@ Supported distributions:
|
||||
|
||||
If you are using CentOS 7, you need to install these prequirement to build from source code:
|
||||
|
||||
```bash
|
||||
```bash
|
||||
yum install epel-release -y
|
||||
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y
|
||||
```
|
||||
@@ -381,9 +381,13 @@ you may refer to the man pages of the applications, respectively.
|
||||
for local port forwarding,
|
||||
only available in tunnel mode
|
||||
|
||||
[-6] Resovle hostname to IPv6 address first.
|
||||
|
||||
[-d <addr>] setup name servers for internal DNS resolver,
|
||||
only available in server mode
|
||||
|
||||
[--reuse-port] Enable port reuse.
|
||||
|
||||
[--fast-open] enable TCP fast open,
|
||||
only available in local and server mode,
|
||||
with Linux kernel > 3.7.0
|
||||
@@ -394,6 +398,12 @@ you may refer to the man pages of the applications, respectively.
|
||||
[--manager-address <addr>] UNIX domain socket address
|
||||
only available in server and manager mode
|
||||
|
||||
[--mtu <MTU>] MTU of your network interface.
|
||||
|
||||
[--mptcp] Enable Multipath TCP on MPTCP Kernel.
|
||||
|
||||
[--no-delay] Enable TCP_NODELAY.
|
||||
|
||||
[--executable <path>] path to the executable of ss-server
|
||||
only available in manager mode
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
_ss_local()
|
||||
{
|
||||
local cur prev opts ciphers
|
||||
opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -v -h --reuse-port --fast-open --acl --mtu --mptcp --key --plugin --plugin-opts --help'
|
||||
opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -v -h --reuse-port --fast-open --acl --mtu --mptcp --no-delay --key --plugin --plugin-opts --help'
|
||||
ciphers='rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256-cfb aes-128-ctr aes-192-ctr aes-256-ctr camellia-128-cfb camellia-192-cfb camellia-256-cfb bf-cfb chacha20-ietf-poly1305 salsa20 chacha20 chacha20-ietf'
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
_ss_server()
|
||||
{
|
||||
local cur prev opts ciphers
|
||||
opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -6 -d -v -h --reuse-port --fast-open --acl --manager-address --mtu --mptcp --key --plugin --plugin-opts --help'
|
||||
opts='-s -p -l -k -m -a -f -t -c -n -i -b -u -U -6 -d -v -h --reuse-port --fast-open --acl --manager-address --mtu --mptcp --no-delay --key --plugin --plugin-opts --help'
|
||||
ciphers='rc4-md5 aes-128-gcm aes-192-gcm aes-256-gcm aes-128-cfb aes-192-cfb aes-256-cfb aes-128-ctr aes-192-ctr aes-256-ctr camellia-128-cfb camellia-192-cfb camellia-256-cfb bf-cfb chacha20-ietf-poly1305 salsa20 chacha20 chacha20-ietf'
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
|
||||
@@ -24,6 +24,7 @@ _arguments "-h::" \
|
||||
"--acl:acl file:_files" \
|
||||
"--mtu::" \
|
||||
"--mptcp::" \
|
||||
"--no-delay::" \
|
||||
"--key:key in base64:" \
|
||||
"--plugin:plugin name:" \
|
||||
"--plugin-opts:plugin options:" \
|
||||
|
||||
@@ -23,6 +23,7 @@ _arguments "-h::" \
|
||||
"--acl:acl file:_files" \
|
||||
"--mtu::" \
|
||||
"--mptcp::" \
|
||||
"--no-delay::" \
|
||||
"--key:key in base64:" \
|
||||
"--plugin:plugin name:" \
|
||||
"--plugin-opts:plugin options:" \
|
||||
|
||||
@@ -27,6 +27,7 @@ _arguments "-h::" \
|
||||
"--acl:acl file:_files" \
|
||||
"--mtu::" \
|
||||
"--mptcp::" \
|
||||
"--no-delay::" \
|
||||
"--key:key in base64:" \
|
||||
"--plugin:plugin name:" \
|
||||
"--plugin-opts:plugin options:" \
|
||||
|
||||
@@ -179,6 +179,7 @@ The config file equivalent of command line options is listed as example below.
|
||||
| -a nobody | "user": "nobody"
|
||||
| --fast-open | "fast_open": true
|
||||
| --reuse-port | "reuse_port": true
|
||||
| --no-delay | "no_delay": true
|
||||
| --plugin "obfs-server" | "plugin": "obfs-server"
|
||||
| --plugin-opts "obfs=http" | "plugin_opts": "obfs=http"
|
||||
| -6 | "ipv6_first": true
|
||||
|
||||
@@ -326,6 +326,11 @@ read_jconf(const char *file)
|
||||
"invalid config file: option 'use_syslog' must be a boolean");
|
||||
use_syslog = value->u.boolean;
|
||||
#endif
|
||||
} else if (strcmp(name, "no_delay") == 0) {
|
||||
check_json_value_type(
|
||||
value, json_boolean,
|
||||
"invalid config file: option 'no_delay' must be a boolean");
|
||||
conf.no_delay = value->u.boolean;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -86,6 +86,7 @@ typedef struct {
|
||||
int mtu;
|
||||
int mptcp;
|
||||
int ipv6_first;
|
||||
int no_delay;
|
||||
} jconf_t;
|
||||
|
||||
jconf_t *read_jconf(const char *file);
|
||||
|
||||
@@ -1493,6 +1493,9 @@ main(int argc, char **argv)
|
||||
if (mptcp == 0) {
|
||||
mptcp = conf->mptcp;
|
||||
}
|
||||
if (no_delay == 0) {
|
||||
no_delay = conf->no_delay;
|
||||
}
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
if (nofile == 0) {
|
||||
nofile = conf->nofile;
|
||||
@@ -1563,6 +1566,10 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (no_delay) {
|
||||
LOGI("enable TCP no-delay");
|
||||
}
|
||||
|
||||
if (ipv6first) {
|
||||
LOGI("resolving hostname to IPv6 address first");
|
||||
}
|
||||
|
||||
@@ -1071,6 +1071,9 @@ main(int argc, char **argv)
|
||||
if (mptcp == 0) {
|
||||
mptcp = conf->mptcp;
|
||||
}
|
||||
if (no_delay == 0) {
|
||||
no_delay = conf->no_delay;
|
||||
}
|
||||
if (reuse_port == 0) {
|
||||
reuse_port = conf->reuse_port;
|
||||
}
|
||||
@@ -1150,6 +1153,10 @@ main(int argc, char **argv)
|
||||
daemonize(pid_path);
|
||||
}
|
||||
|
||||
if (no_delay) {
|
||||
LOGI("enable TCP no-delay");
|
||||
}
|
||||
|
||||
if (ipv6first) {
|
||||
LOGI("resolving hostname to IPv6 address first");
|
||||
}
|
||||
|
||||
@@ -1679,6 +1679,9 @@ main(int argc, char **argv)
|
||||
if (mptcp == 0) {
|
||||
mptcp = conf->mptcp;
|
||||
}
|
||||
if (no_delay == 0) {
|
||||
no_delay = conf->no_delay;
|
||||
}
|
||||
if (reuse_port == 0) {
|
||||
reuse_port = conf->reuse_port;
|
||||
}
|
||||
@@ -1771,6 +1774,10 @@ main(int argc, char **argv)
|
||||
LOGI("TCP relay disabled");
|
||||
}
|
||||
|
||||
if (no_delay) {
|
||||
LOGI("enable TCP no-delay");
|
||||
}
|
||||
|
||||
// ignore SIGPIPE
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGABRT, SIG_IGN);
|
||||
|
||||
@@ -974,6 +974,9 @@ main(int argc, char **argv)
|
||||
if (mptcp == 0) {
|
||||
mptcp = conf->mptcp;
|
||||
}
|
||||
if (no_delay == 0) {
|
||||
no_delay = conf->no_delay;
|
||||
}
|
||||
if (reuse_port == 0) {
|
||||
reuse_port = conf->reuse_port;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user