mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-21 06:23:52 +00:00
Fix #2267
This commit is contained in:
@@ -177,6 +177,7 @@ The config file equivalent of command line options is listed as example below.
|
||||
| -m "aes-256-cfb" | "method": "aes-256-cfb"
|
||||
| -t 60 | "timeout": 60
|
||||
| -a nobody | "user": "nobody"
|
||||
| --acl "/path/to/acl" | "acl": "/path/to/acl"
|
||||
| --fast-open | "fast_open": true
|
||||
| --reuse-port | "reuse_port": true
|
||||
| --no-delay | "no_delay": true
|
||||
|
||||
@@ -164,6 +164,11 @@ trimwhitespace(char *str)
|
||||
int
|
||||
init_acl(const char *path)
|
||||
{
|
||||
if (path == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// initialize ipset
|
||||
ipset_init_library();
|
||||
|
||||
|
||||
@@ -330,6 +330,8 @@ read_jconf(const char *file)
|
||||
conf.no_delay = value->u.boolean;
|
||||
} else if (strcmp(name, "workdir") == 0) {
|
||||
conf.workdir = to_string(value);
|
||||
} else if (strcmp(name, "acl") == 0) {
|
||||
conf.acl = to_string(value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -86,6 +86,7 @@ typedef struct {
|
||||
int ipv6_first;
|
||||
int no_delay;
|
||||
char *workdir;
|
||||
char *acl;
|
||||
} jconf_t;
|
||||
|
||||
jconf_t *read_jconf(const char *file);
|
||||
|
||||
@@ -1683,6 +1683,9 @@ main(int argc, char **argv)
|
||||
if (ipv6first == 0) {
|
||||
ipv6first = conf->ipv6_first;
|
||||
}
|
||||
if (acl == 0) {
|
||||
acl = !init_acl(conf->acl);
|
||||
}
|
||||
}
|
||||
|
||||
if (remote_num == 0 || remote_port == NULL ||
|
||||
|
||||
@@ -1054,6 +1054,9 @@ main(int argc, char **argv)
|
||||
{
|
||||
workdir = conf->workdir;
|
||||
}
|
||||
if (acl == NULL) {
|
||||
acl = conf->acl;
|
||||
}
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
if (nofile == 0) {
|
||||
nofile = conf->nofile;
|
||||
|
||||
@@ -1817,6 +1817,9 @@ main(int argc, char **argv)
|
||||
if (ipv6first == 0) {
|
||||
ipv6first = conf->ipv6_first;
|
||||
}
|
||||
if (acl == 0) {
|
||||
acl = !init_acl(conf->acl);
|
||||
}
|
||||
}
|
||||
|
||||
if (server_num == 0) {
|
||||
|
||||
Reference in New Issue
Block a user