Skip to content

Commit

Permalink
add user config option
Browse files Browse the repository at this point in the history
  • Loading branch information
vfreex authored and madeye committed Nov 25, 2016
1 parent aca5f5d commit a8fdd77
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/shadowsocks-libev.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/jconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/jconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef struct {
char *password;
char *method;
char *timeout;
char *user;
int auth;
int fast_open;
int nofile;
Expand Down
3 changes: 3 additions & 0 deletions src/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a8fdd77

Please sign in to comment.