mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-22 14:25:44 +00:00
Delete options (--snd-buf, --rcv-buf and -L)
This commit is contained in:
parent
676227271d
commit
e4dff6de47
40
main.c
40
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 <ip> Connection binded IP, default ::\n"
|
||||
" -b, --buf-size <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 <size> Set SO_SNDBUF option for out. conn.\n"
|
||||
" -R, --rcv-buf <size> Set SO_RCVBUF option for out. conn.\n"
|
||||
" -g, --def-ttl <num> 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) {
|
||||
|
3
params.h
3
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;
|
||||
};
|
||||
|
||||
|
32
proxy.c
32
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;
|
||||
|
@ -18,9 +18,6 @@ $ ./ciadpi --method disorder --split-pos 3 --port 1080
|
||||
Адрес, к которому будут привязаны исходящие соединения, по умолчанию ::
|
||||
-b, --buf-size <size>
|
||||
Максимальный размер данных, получаемых и отправляемых за один вызов
|
||||
-S, --snd-buf <size>
|
||||
-R, --rcv-buf <size>
|
||||
Значение параметров SO_SNDBUF и SO_RCVBUF для исходящих соединений
|
||||
-g, --def-ttl <num>
|
||||
Значение TTL для всех исходящий соединений
|
||||
-N, --no-domain
|
||||
|
Loading…
Reference in New Issue
Block a user