diff --git a/main.c b/main.c index 0b4c6e2..94d7ecd 100644 --- a/main.c +++ b/main.c @@ -44,9 +44,6 @@ struct params params = { .resolve = 1, .max_open = 512, .bfsize = 16384, - .nodelay = 1, - .send_bfsz = 0, - .recv_bfsz = 0, .baddr = { .sin6_family = AF_INET6 }, @@ -64,9 +61,6 @@ const char help_text[] = { " -I --conn-ip Connection binded IP, default ::\n" " -b, --buf-size Buffer size, default 16384\n" " -x, --debug Print logs, 0, 1 or 2\n" - //" -L, --nodelay <0 or 1> Set TCP_NODELAY option\n" - " -S, --snd-buf Set SO_SNDBUF option for out. conn.\n" - " -R, --rcv-buf Set SO_RCVBUF option for out. conn.\n" " -g, --def-ttl TTL for all outgoing connections\n" // desync options " -K, --desync-known Desync only HTTP and TLS with SNI\n" @@ -98,9 +92,6 @@ const struct option options[] = { {"port", 1, 0, 'p'}, {"conn-ip", 1, 0, 'I'}, {"buf-size", 1, 0, 'b'}, - //{"nodelay", 1, 0, 'L'}, - {"snd-buf", 1, 0, 'S'}, - {"rcv-buf", 1, 0, 'R'}, {"max-conn", 1, 0, 'c'}, {"debug", 1, 0, 'x'}, @@ -165,7 +156,7 @@ void daemonize(void) exit(0); } if (setsid() < 0) { - exit(1); + exit(1); } close(STDIN_FILENO); close(STDOUT_FILENO); @@ -300,30 +291,6 @@ int main(int argc, char **argv) params.bfsize = val; break; - case 'L': - val = strtol(optarg, &end, 0); - if (val < 0 || val > 1 || *end) - invalid = 1; - else - params.nodelay = val; - break; - - case 'S': - val = strtol(optarg, &end, 0); - if (val <= 0 || val > INT_MAX || *end) - invalid = 1; - else - params.send_bfsz = val; - break; - - case 'R': - val = strtol(optarg, &end, 0); - if (val <= 0 || val > INT_MAX || *end) - invalid = 1; - else - params.recv_bfsz = val; - break; - case 'c': val = strtol(optarg, &end, 0); if (val <= 0 || val >= (0xffff/2) || *end) @@ -470,11 +437,6 @@ int main(int argc, char **argv) if (b.sa.sa_family != AF_INET6) { params.ipv6 = 0; } - if (params.send_bfsz && - params.send_bfsz * 2 <= params.bfsize) { - fprintf(stderr, "send buffer too small\n"); - return -1; - } FILE *file; if (pidfile) { diff --git a/params.h b/params.h index 3416e11..cfc9a8d 100644 --- a/params.h +++ b/params.h @@ -24,9 +24,6 @@ struct params { int max_open; int debug; size_t bfsize; - int nodelay; - int send_bfsz; - int recv_bfsz; struct sockaddr_in6 baddr; }; diff --git a/proxy.c b/proxy.c index 9a11c6a..8abac01 100644 --- a/proxy.c +++ b/proxy.c @@ -74,30 +74,6 @@ static inline int nb_socket(int domain, int type) } -int setopts(int fd) -{ - if (params.nodelay && - setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, - (char *)¶ms.nodelay, sizeof(params.nodelay))) { - perror("setsockopt TCP_NODELAY"); - return -1; - } - if (params.send_bfsz && - setsockopt(fd, SOL_SOCKET, SO_SNDBUF, - (char *)¶ms.send_bfsz, sizeof(params.send_bfsz))) { - perror("setsockopt SO_SNDBUF"); - return -1; - } - if (params.recv_bfsz && - setsockopt(fd, SOL_SOCKET, SO_RCVBUF, - (char *)¶ms.recv_bfsz, sizeof(params.recv_bfsz))) { - perror("setsockopt SO_RCVBUF"); - return -1; - } - return 0; -} - - int resolve(char *host, int len, struct sockaddr_ina *addr) { @@ -311,7 +287,10 @@ int create_conn(struct poolhd *pool, return -1; } #endif - if (setopts(sfd) < 0) { + int one = 1; + if (setsockopt(sfd, IPPROTO_TCP, + TCP_NODELAY, (char *)&one, sizeof(one))) { + perror("setsockopt TCP_NODELAY"); close(sfd); return -1; } @@ -414,8 +393,9 @@ static inline int on_accept(struct poolhd *pool, struct eval *val) continue; } #endif + int one = 1; if (setsockopt(c, IPPROTO_TCP, TCP_NODELAY, - (char *)¶ms.nodelay, sizeof(params.nodelay))) { + (char *)&one, sizeof(one))) { perror("setsockopt TCP_NODELAY"); close(c); continue; diff --git a/readme.txt b/readme.txt index b5ffa0c..ad6b1ee 100644 --- a/readme.txt +++ b/readme.txt @@ -18,9 +18,6 @@ $ ./ciadpi --method disorder --split-pos 3 --port 1080 Адрес, к которому будут привязаны исходящие соединения, по умолчанию :: -b, --buf-size Максимальный размер данных, получаемых и отправляемых за один вызов --S, --snd-buf --R, --rcv-buf - Значение параметров SO_SNDBUF и SO_RCVBUF для исходящих соединений -g, --def-ttl Значение TTL для всех исходящий соединений -N, --no-domain