Browse Source

Add local bind address config

specific local address to bind in `config.json`:
`"local": "127.0.0.1"`
pull/27/head
Guizai 11 years ago
parent
commit
5d9c93a6d4
4 changed files with 7 additions and 0 deletions
  1. 4
      src/jconf.c
  2. 1
      src/jconf.h
  3. 1
      src/local.c
  4. 1
      src/redir.c

4
src/jconf.c

@ -137,6 +137,10 @@ jconf_t *read_jconf(const char* file)
{
conf.remote_port = to_string(value);
}
else if (strcmp(name, "local") == 0)
{
conf.local_addr = to_string(value);
}
else if (strcmp(name, "local_port") == 0)
{
conf.local_port = to_string(value);

1
src/jconf.h

@ -17,6 +17,7 @@ typedef struct
int remote_num;
remote_addr_t remote_addr[MAX_REMOTE_NUM];
char *remote_port;
char *local_addr;
char *local_port;
char *password;
char *method;

1
src/local.c

@ -876,6 +876,7 @@ int main (int argc, char **argv)
}
}
if (remote_port == NULL) remote_port = conf->remote_port;
if (local_addr == NULL) local_addr = conf->local_addr;
if (local_port == NULL) local_port = conf->local_port;
if (password == NULL) password = conf->password;
if (method == NULL) method = conf->method;

1
src/redir.c

@ -729,6 +729,7 @@ int main (int argc, char **argv)
}
}
if (remote_port == NULL) remote_port = conf->remote_port;
if (local_addr == NULL) local_addr = conf->local_addr;
if (local_port == NULL) local_port = conf->local_port;
if (password == NULL) password = conf->password;
if (method == NULL) method = conf->method;

Loading…
Cancel
Save