|
|
@ -91,8 +91,9 @@ ev_tstamp last = 0; |
|
|
|
char *prefix; |
|
|
|
#endif |
|
|
|
|
|
|
|
static int acl = 0; |
|
|
|
static int mode = TCP_ONLY; |
|
|
|
static int acl = 0; |
|
|
|
static int mode = TCP_ONLY; |
|
|
|
static int ipv6first = 0; |
|
|
|
|
|
|
|
static int fast_open = 0; |
|
|
|
#ifdef HAVE_SETRLIMIT |
|
|
@ -634,9 +635,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents) |
|
|
|
int err; |
|
|
|
memset(&storage, 0, sizeof(struct sockaddr_storage)); |
|
|
|
if (atyp == 1 || atyp == 4) { |
|
|
|
err = get_sockaddr(ip, port, &storage, 0); |
|
|
|
err = get_sockaddr(ip, port, &storage, 0, ipv6first); |
|
|
|
} else { |
|
|
|
err = get_sockaddr(host, port, &storage, 1); |
|
|
|
err = get_sockaddr(host, port, &storage, 1, ipv6first); |
|
|
|
} |
|
|
|
if (err != -1) { |
|
|
|
remote = create_remote(server->listener, (struct sockaddr *)&storage); |
|
|
@ -737,6 +738,7 @@ stat_update_cb() |
|
|
|
last = now; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
static void |
|
|
@ -1154,10 +1156,10 @@ main(int argc, char **argv) |
|
|
|
USE_TTY(); |
|
|
|
|
|
|
|
#ifdef ANDROID |
|
|
|
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:P:huUvVA", |
|
|
|
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:P:huUvVA6", |
|
|
|
long_options, &option_index)) != -1) { |
|
|
|
#else |
|
|
|
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUvA", |
|
|
|
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUvA6", |
|
|
|
long_options, &option_index)) != -1) { |
|
|
|
#endif |
|
|
|
switch (c) { |
|
|
@ -1235,6 +1237,9 @@ main(int argc, char **argv) |
|
|
|
case 'A': |
|
|
|
auth = 1; |
|
|
|
break; |
|
|
|
case '6': |
|
|
|
ipv6first = 1; |
|
|
|
break; |
|
|
|
#ifdef ANDROID |
|
|
|
case 'V': |
|
|
|
vpn = 1; |
|
|
@ -1352,6 +1357,10 @@ main(int argc, char **argv) |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
if (ipv6first) { |
|
|
|
LOGI("resolving hostname to IPv6 address first"); |
|
|
|
} |
|
|
|
|
|
|
|
if (auth) { |
|
|
|
LOGI("onetime authentication enabled"); |
|
|
|
} |
|
|
@ -1380,7 +1389,7 @@ main(int argc, char **argv) |
|
|
|
remote_addr[i].port; |
|
|
|
struct sockaddr_storage *storage = ss_malloc(sizeof(struct sockaddr_storage)); |
|
|
|
memset(storage, 0, sizeof(struct sockaddr_storage)); |
|
|
|
if (get_sockaddr(host, port, storage, 1) == -1) { |
|
|
|
if (get_sockaddr(host, port, storage, 1, ipv6first) == -1) { |
|
|
|
FATAL("failed to resolve the provided hostname"); |
|
|
|
} |
|
|
|
listen_ctx.remote_addr[i] = (struct sockaddr *)storage; |
|
|
@ -1536,7 +1545,7 @@ start_ss_local_server(profile_t profile) |
|
|
|
|
|
|
|
struct sockaddr_storage *storage = ss_malloc(sizeof(struct sockaddr_storage)); |
|
|
|
memset(storage, 0, sizeof(struct sockaddr_storage)); |
|
|
|
if (get_sockaddr(remote_host, remote_port_str, storage, 1) == -1) { |
|
|
|
if (get_sockaddr(remote_host, remote_port_str, storage, 1, ipv6first) == -1) { |
|
|
|
return -1; |
|
|
|
} |
|
|
|
|
|
|
|