Skip to content

Commit 77eeba8

Browse files
committed
HevSocks5TProxy: Supports standard and pipeline socks5 handshakes.
1 parent 685e72f commit 77eeba8

5 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ socks5:
6767
address: 127.0.0.1
6868
# Socks5 UDP relay mode (tcp|udp)
6969
udp: 'udp'
70+
# Socks5 handshake using pipeline mode
71+
# pipeline: false
7072
# Socks5 server username
7173
username: 'username'
7274
# Socks5 server password

conf/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ socks5:
77
address: 127.0.0.1
88
# Socks5 UDP relay mode (tcp|udp)
99
udp: 'udp'
10+
# Socks5 handshake using pipeline mode
11+
# pipeline: false
1012
# Socks5 server username
1113
username: 'username'
1214
# Socks5 server password

src/hev-config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ hev_config_parse_server (yaml_document_t *doc, yaml_node_t *base,
4444
const char *user = NULL;
4545
const char *pass = NULL;
4646
const char *mark = NULL;
47+
const char *pipe = NULL;
4748

4849
if (!base || YAML_MAPPING_NODE != base->type || !srv)
4950
return -1;
@@ -72,6 +73,8 @@ hev_config_parse_server (yaml_document_t *doc, yaml_node_t *base,
7273
addr = value;
7374
else if (0 == strcmp (key, "udp"))
7475
udpm = value;
76+
else if (0 == strcmp (key, "pipeline"))
77+
pipe = value;
7578
else if (0 == strcmp (key, "username"))
7679
user = value;
7780
else if (0 == strcmp (key, "password"))
@@ -98,6 +101,9 @@ hev_config_parse_server (yaml_document_t *doc, yaml_node_t *base,
98101
strncpy (srv->addr, addr, 256 - 1);
99102
srv->port = strtoul (port, NULL, 10);
100103

104+
if (pipe && (strcasecmp (pipe, "true") == 0))
105+
srv->pipeline = 1;
106+
101107
if (udpm && (strcasecmp (udpm, "udp") == 0))
102108
srv->udp_in_udp = 1;
103109

src/hev-config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct _HevConfigServer
1919
unsigned int mark;
2020
short udp_in_udp;
2121
unsigned short port;
22+
unsigned char pipeline;
2223
char addr[256];
2324
};
2425

src/hev-socks5-session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ hev_socks5_session_run (HevTProxySession *base)
4848
LOG_D ("%p socks5 client auth %s:%s", base, srv->user, srv->pass);
4949
}
5050

51-
res = hev_socks5_client_handshake (HEV_SOCKS5_CLIENT (base));
51+
res = hev_socks5_client_handshake (HEV_SOCKS5_CLIENT (base), srv->pipeline);
5252
if (res < 0) {
5353
LOG_E ("%p socks5 session handshake", base);
5454
return;

0 commit comments

Comments
 (0)