mirror of
https://github.com/hufrea/byedpi.git
synced 2024-11-22 06:55:22 +03:00
Delete options (--snd-buf, --rcv-buf and -L)
This commit is contained in:
parent
676227271d
commit
e4dff6de47
4 changed files with 7 additions and 71 deletions
40
main.c
40
main.c
|
@ -44,9 +44,6 @@ struct params params = {
|
||||||
.resolve = 1,
|
.resolve = 1,
|
||||||
.max_open = 512,
|
.max_open = 512,
|
||||||
.bfsize = 16384,
|
.bfsize = 16384,
|
||||||
.nodelay = 1,
|
|
||||||
.send_bfsz = 0,
|
|
||||||
.recv_bfsz = 0,
|
|
||||||
.baddr = {
|
.baddr = {
|
||||||
.sin6_family = AF_INET6
|
.sin6_family = AF_INET6
|
||||||
},
|
},
|
||||||
|
@ -64,9 +61,6 @@ const char help_text[] = {
|
||||||
" -I --conn-ip <ip> Connection binded IP, default ::\n"
|
" -I --conn-ip <ip> Connection binded IP, default ::\n"
|
||||||
" -b, --buf-size <size> Buffer size, default 16384\n"
|
" -b, --buf-size <size> Buffer size, default 16384\n"
|
||||||
" -x, --debug Print logs, 0, 1 or 2\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"
|
" -g, --def-ttl <num> TTL for all outgoing connections\n"
|
||||||
// desync options
|
// desync options
|
||||||
" -K, --desync-known Desync only HTTP and TLS with SNI\n"
|
" -K, --desync-known Desync only HTTP and TLS with SNI\n"
|
||||||
|
@ -98,9 +92,6 @@ const struct option options[] = {
|
||||||
{"port", 1, 0, 'p'},
|
{"port", 1, 0, 'p'},
|
||||||
{"conn-ip", 1, 0, 'I'},
|
{"conn-ip", 1, 0, 'I'},
|
||||||
{"buf-size", 1, 0, 'b'},
|
{"buf-size", 1, 0, 'b'},
|
||||||
//{"nodelay", 1, 0, 'L'},
|
|
||||||
{"snd-buf", 1, 0, 'S'},
|
|
||||||
{"rcv-buf", 1, 0, 'R'},
|
|
||||||
{"max-conn", 1, 0, 'c'},
|
{"max-conn", 1, 0, 'c'},
|
||||||
{"debug", 1, 0, 'x'},
|
{"debug", 1, 0, 'x'},
|
||||||
|
|
||||||
|
@ -165,7 +156,7 @@ void daemonize(void)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (setsid() < 0) {
|
if (setsid() < 0) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
close(STDOUT_FILENO);
|
close(STDOUT_FILENO);
|
||||||
|
@ -300,30 +291,6 @@ int main(int argc, char **argv)
|
||||||
params.bfsize = val;
|
params.bfsize = val;
|
||||||
break;
|
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':
|
case 'c':
|
||||||
val = strtol(optarg, &end, 0);
|
val = strtol(optarg, &end, 0);
|
||||||
if (val <= 0 || val >= (0xffff/2) || *end)
|
if (val <= 0 || val >= (0xffff/2) || *end)
|
||||||
|
@ -470,11 +437,6 @@ int main(int argc, char **argv)
|
||||||
if (b.sa.sa_family != AF_INET6) {
|
if (b.sa.sa_family != AF_INET6) {
|
||||||
params.ipv6 = 0;
|
params.ipv6 = 0;
|
||||||
}
|
}
|
||||||
if (params.send_bfsz &&
|
|
||||||
params.send_bfsz * 2 <= params.bfsize) {
|
|
||||||
fprintf(stderr, "send buffer too small\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE *file;
|
FILE *file;
|
||||||
if (pidfile) {
|
if (pidfile) {
|
||||||
|
|
3
params.h
3
params.h
|
@ -24,9 +24,6 @@ struct params {
|
||||||
int max_open;
|
int max_open;
|
||||||
int debug;
|
int debug;
|
||||||
size_t bfsize;
|
size_t bfsize;
|
||||||
int nodelay;
|
|
||||||
int send_bfsz;
|
|
||||||
int recv_bfsz;
|
|
||||||
struct sockaddr_in6 baddr;
|
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,
|
int resolve(char *host, int len,
|
||||||
struct sockaddr_ina *addr)
|
struct sockaddr_ina *addr)
|
||||||
{
|
{
|
||||||
|
@ -311,7 +287,10 @@ int create_conn(struct poolhd *pool,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
close(sfd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -414,8 +393,9 @@ static inline int on_accept(struct poolhd *pool, struct eval *val)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
int one = 1;
|
||||||
if (setsockopt(c, IPPROTO_TCP, TCP_NODELAY,
|
if (setsockopt(c, IPPROTO_TCP, TCP_NODELAY,
|
||||||
(char *)¶ms.nodelay, sizeof(params.nodelay))) {
|
(char *)&one, sizeof(one))) {
|
||||||
perror("setsockopt TCP_NODELAY");
|
perror("setsockopt TCP_NODELAY");
|
||||||
close(c);
|
close(c);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -18,9 +18,6 @@ $ ./ciadpi --method disorder --split-pos 3 --port 1080
|
||||||
Адрес, к которому будут привязаны исходящие соединения, по умолчанию ::
|
Адрес, к которому будут привязаны исходящие соединения, по умолчанию ::
|
||||||
-b, --buf-size <size>
|
-b, --buf-size <size>
|
||||||
Максимальный размер данных, получаемых и отправляемых за один вызов
|
Максимальный размер данных, получаемых и отправляемых за один вызов
|
||||||
-S, --snd-buf <size>
|
|
||||||
-R, --rcv-buf <size>
|
|
||||||
Значение параметров SO_SNDBUF и SO_RCVBUF для исходящих соединений
|
|
||||||
-g, --def-ttl <num>
|
-g, --def-ttl <num>
|
||||||
Значение TTL для всех исходящий соединений
|
Значение TTL для всех исходящий соединений
|
||||||
-N, --no-domain
|
-N, --no-domain
|
||||||
|
|
Loading…
Reference in a new issue