diff --git a/doc/shadowsocks-libev.asciidoc b/doc/shadowsocks-libev.asciidoc index 21630714e..1933cf08a 100644 --- a/doc/shadowsocks-libev.asciidoc +++ b/doc/shadowsocks-libev.asciidoc @@ -165,6 +165,7 @@ The config file equivalent of command line options is listed as example below. | -k "PasSworD" | "password": "PasSworD" | -m "aes-256-cfb" | "method": "aes-256-cfb" | -t 60 | "timeout": 60 +| -a nobody | "user": "nobody" | --fast-open | "fast_open": true | -6 | "ipv6_first": true | -A | "auth": true diff --git a/src/jconf.c b/src/jconf.c index 750952862..cce428723 100644 --- a/src/jconf.c +++ b/src/jconf.c @@ -197,6 +197,8 @@ read_jconf(const char *file) conf.method = to_string(value); } else if (strcmp(name, "timeout") == 0) { conf.timeout = to_string(value); + } else if (strcmp(name, "user") == 0) { + conf.user = to_string(value); } else if (strcmp(name, "fast_open") == 0) { check_json_value_type(value, json_boolean, "invalid config file: option 'fast_open' must be a boolean"); diff --git a/src/jconf.h b/src/jconf.h index fe345d480..f8dc1f567 100644 --- a/src/jconf.h +++ b/src/jconf.h @@ -55,6 +55,7 @@ typedef struct { char *password; char *method; char *timeout; + char *user; int auth; int fast_open; int nofile; diff --git a/src/local.c b/src/local.c index 9bea647f1..7b2ce9e58 100644 --- a/src/local.c +++ b/src/local.c @@ -1291,6 +1291,9 @@ main(int argc, char **argv) if (timeout == NULL) { timeout = conf->timeout; } + if (user == NULL) { + user = conf->user; + } if (auth == 0) { auth = conf->auth; } diff --git a/src/manager.c b/src/manager.c index 9d9d1332e..7c05674ee 100644 --- a/src/manager.c +++ b/src/manager.c @@ -744,6 +744,9 @@ main(int argc, char **argv) if (timeout == NULL) { timeout = conf->timeout; } + if (user == NULL) { + user = conf->user; + } #ifdef TCP_FASTOPEN if (fast_open == 0) { fast_open = conf->fast_open; diff --git a/src/redir.c b/src/redir.c index 25497bfad..b7c9c1f87 100644 --- a/src/redir.c +++ b/src/redir.c @@ -898,6 +898,9 @@ main(int argc, char **argv) if (timeout == NULL) { timeout = conf->timeout; } + if (user == NULL) { + user = conf->user; + } if (auth == 0) { auth = conf->auth; } diff --git a/src/server.c b/src/server.c index e064b80ad..e68939ec4 100644 --- a/src/server.c +++ b/src/server.c @@ -1699,6 +1699,9 @@ main(int argc, char **argv) if (timeout == NULL) { timeout = conf->timeout; } + if (user == NULL) { + user = conf->user; + } if (auth == 0) { auth = conf->auth; } diff --git a/src/tunnel.c b/src/tunnel.c index df1403068..3b82987a9 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -885,6 +885,9 @@ main(int argc, char **argv) if (timeout == NULL) { timeout = conf->timeout; } + if (user == NULL) { + user = conf->user; + } if (auth == 0) { auth = conf->auth; }