mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-29 12:36:53 +00:00
Add prefix option for Android
This commit is contained in:
+6
-2
@@ -45,6 +45,8 @@
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern char *prefix;
|
||||
|
||||
int protect_socket(int fd)
|
||||
{
|
||||
int sock;
|
||||
@@ -62,7 +64,8 @@ int protect_socket(int fd)
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
|
||||
const char path[] = "/data/data/com.github.shadowsocks/protect_path";
|
||||
char path[256];
|
||||
sprintf(path, "%s/protect_path", prefix);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
@@ -109,7 +112,8 @@ int send_traffic_stat(uint64_t tx, uint64_t rx)
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
|
||||
const char path[] = "/data/data/com.github.shadowsocks/stat_path";
|
||||
char path[256];
|
||||
sprintf(path, "%s/protect_path", prefix);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
|
||||
+5
-1
@@ -85,6 +85,7 @@ int vpn = 0;
|
||||
uint64_t tx = 0;
|
||||
uint64_t rx = 0;
|
||||
ev_tstamp last = 0;
|
||||
char *prefix;
|
||||
#endif
|
||||
|
||||
static int acl = 0;
|
||||
@@ -994,7 +995,7 @@ int 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:uvVA",
|
||||
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:uvVAP",
|
||||
long_options, &option_index)) != -1) {
|
||||
#else
|
||||
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:uvA",
|
||||
@@ -1064,6 +1065,9 @@ int main(int argc, char **argv)
|
||||
case 'V':
|
||||
vpn = 1;
|
||||
break;
|
||||
case 'P':
|
||||
prefix = optarg;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -87,6 +87,7 @@ static void close_and_free_server(EV_P_ server_t *server);
|
||||
|
||||
#ifdef ANDROID
|
||||
int vpn = 0;
|
||||
char *prefix;
|
||||
#endif
|
||||
int verbose = 0;
|
||||
|
||||
@@ -700,7 +701,7 @@ int main(int argc, char **argv)
|
||||
USE_TTY();
|
||||
|
||||
#ifdef ANDROID
|
||||
while ((c = getopt(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:uUvVA")) != -1) {
|
||||
while ((c = getopt(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:uUvVAP")) != -1) {
|
||||
#else
|
||||
while ((c = getopt(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:uUvA")) != -1) {
|
||||
#endif
|
||||
@@ -766,6 +767,9 @@ int main(int argc, char **argv)
|
||||
case 'V':
|
||||
vpn = 1;
|
||||
break;
|
||||
case 'P':
|
||||
prefix = optarg;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user