Browse Source

bump version

pull/14/head
Max Lv 11 years ago
parent
commit
5736e966f0
6 changed files with 46 additions and 25 deletions
  1. 2
      configure.ac
  2. 11
      src/local.c
  3. 9
      src/server.c
  4. 2
      src/udprelay.c
  5. 9
      src/udprelay.h
  6. 38
      src/utils.c

2
configure.ac

@ -2,7 +2,7 @@ dnl -*- Autoconf -*-
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([shadowsocks], [1.3.3], [max.c.lv@gmail.com])
AC_INIT([shadowsocks], [1.4.0], [max.c.lv@gmail.com])
AC_CONFIG_SRCDIR([src/encrypt.c])
AC_CONFIG_HEADERS([config.h])

11
src/local.c

@ -40,6 +40,7 @@
#endif
int verbose = 0;
int udprelay = 0;
static int setnonblocking(int fd)
{
@ -215,7 +216,7 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents)
struct sockaddr_in s_addr;
memset(&s_addr, 0, sizeof(s_addr));
if (request->cmd == 3)
if (udprelay && request->cmd == 3)
{
socklen_t addr_len = sizeof(s_addr);
getsockname(server->fd, (struct sockaddr *)&s_addr,
@ -799,7 +800,7 @@ int main (int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:i:c:b:v")) != -1)
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:i:c:b:uv")) != -1)
{
switch (c)
{
@ -834,6 +835,9 @@ int main (int argc, char **argv)
case 'b':
local_addr = optarg;
break;
case 'u':
udprelay = 1;
break;
case 'v':
verbose = 1;
break;
@ -926,7 +930,8 @@ int main (int argc, char **argv)
ev_io_start (loop, &listen_ctx.io);
// Setup UDP
udprelay(local_addr, local_port, remote_host[0], remote_port, m, iface);
if (udprelay)
udprelay_init(local_addr, local_port, remote_host[0], remote_port, m, iface);
ev_run (loop, 0);
return 0;

9
src/server.c

@ -40,6 +40,7 @@
#endif
int verbose = 0;
int udprelay = 0;
static int remote_conn = 0;
static int server_conn = 0;
@ -912,7 +913,7 @@ int main (int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:c:i:d:v")) != -1)
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:c:i:d:uv")) != -1)
{
switch (c)
{
@ -945,6 +946,9 @@ int main (int argc, char **argv)
dns_thread_num = atoi(optarg);
if (!dns_thread_num) FATAL("Invalid DNS thread number");
break;
case 'u':
udprelay = 1;
break;
case 'v':
verbose = 1;
break;
@ -1039,7 +1043,8 @@ int main (int argc, char **argv)
}
// Setup UDP
udprelay(server_host[0], server_port, asyncns, m, iface);
if (udprelay)
udprelay_init(server_host[0], server_port, asyncns, m, iface);
// start ev loop
ev_run (loop, 0);

2
src/udprelay.c

@ -733,7 +733,7 @@ void free_cb(void *element)
close_and_free_remote(EV_DEFAULT, remote_ctx);
}
int udprelay(const char *server_host, const char *server_port,
int udprelay_init(const char *server_host, const char *server_port,
#ifdef UDPRELAY_LOCAL
const char *remote_host, const char *remote_port,
#endif

9
src/udprelay.h

@ -72,4 +72,13 @@ static void close_and_free_server(EV_P_ struct server_ctx *server_ctx);
struct remote_ctx* new_remote_ctx(int fd);
struct server_ctx* new_server(int fd);
int udprelay(const char *server_host, const char *server_port,
#ifdef UDPRELAY_LOCAL
const char *remote_host, const char *remote_port,
#endif
#ifdef UDPRELAY_REMOTE
asyncns_t *asyncns,
#endif
int method, const char *interface);
#endif // _UDPRELAY_H

38
src/utils.c

@ -77,25 +77,27 @@ void usage()
printf(" maintained by Max Lv <max.c.lv@gmail.com>\n\n");
printf(" usage:\n\n");
printf(" ss-[local|redir|server]\n");
printf(" -s <server_host> -p <server_port>\n");
printf(" -l <local_port> -k <password>\n");
printf(" [-m <encrypt_method>] [-f <pid_file>]\n");
printf(" [-t <timeout>] [-c <config_file>]\n");
printf(" [-i <interface>] [-b <local_address>]\n");
printf(" -s <server_host> host name or ip address of your remote server\n");
printf(" -p <server_port> port number of your remote server\n");
printf(" -l <local_port>> port number of your local server\n");
printf(" -k <password> password of your remote server\n");
printf("\n");
printf(" options:\n\n");
printf(" encrypt_method: table, rc4,\n");
printf(" aes-128-cfb, aes-192-cfb, aes-256-cfb,\n");
printf(" bf-cfb, camellia-128-cfb, camellia-192-cfb,\n");
printf(" camellia-256-cfb, cast5-cfb, des-cfb,\n");
printf(" idea-cfb, rc2-cfb and seed-cfb\n");
printf(" pid_file: valid path to the pid file\n");
printf(" timeout: socket timeout in senconds\n");
printf(" config_file: json format config file\n");
printf(" interface: specific network interface to bind,\n");
printf(" only avaliable in local and server modes\n");
printf(" local_address: specific local address to bind,\n");
printf(" only avaliable in local and redir modes\n");
printf(" [-m <encrypt_method>] encrypt method, supporting table, rc4,\n");
printf(" aes-128-cfb, aes-192-cfb, aes-256-cfb,\n");
printf(" bf-cfb, camellia-128-cfb, camellia-192-cfb,\n");
printf(" camellia-256-cfb, cast5-cfb, des-cfb,\n");
printf(" idea-cfb, rc2-cfb and seed-cfb\n");
printf(" [-f <pid_file>] valid path to the pid file\n");
printf(" [-t <timeout>] socket timeout in seconds\n");
printf(" [-c <config_file>] json format config file\n");
printf("\n");
printf(" [-i <interface>] specific network interface to bind,\n");
printf(" only avaliable in local and server modes\n");
printf(" [-b <local_address>] specific local address to bind,\n");
printf(" only avaliable in local and redir modes\n");
printf(" [-u] udprelay mode to supprot udp traffic\n");
printf(" only avaliable in local and redir modes\n");
printf(" [-v] verbose mode, debug output in console\n");
printf("\n");
}

Loading…
Cancel
Save