MINOR: checks: Add the via-socks4 option for tcp-check connect rules
With this option, it is possible to establish the connection opened by a
tcp-check connect rule using upstream socks4 proxy. Info from the socks4
parameter on the server are used.
diff --git a/src/checks.c b/src/checks.c
index b2322b2..97f68f1 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -2922,7 +2922,10 @@
ssl_sock_set_servername(conn, connect->sni);
}
#endif
- /* TODO: add support for sock4 option */
+ if ((connect->options & TCPCHK_OPT_SOCKS4) && (s->flags & SRV_F_SOCKS4_PROXY)) {
+ conn->send_proxy_ofs = 1;
+ conn->flags |= CO_FL_SOCKS4;
+ }
if (connect->options & TCPCHK_OPT_SEND_PROXY) {
conn->send_proxy_ofs = 1;
conn->flags |= CO_FL_SEND_PROXY;
@@ -4118,6 +4121,8 @@
}
else if (strcmp(args[cur_arg], "send-proxy") == 0)
conn_opts |= TCPCHK_OPT_SEND_PROXY;
+ else if (strcmp(args[cur_arg], "via-socks4") == 0)
+ conn_opts |= TCPCHK_OPT_SOCKS4;
else if (strcmp(args[cur_arg], "linger") == 0)
conn_opts |= TCPCHK_OPT_LINGER;
#ifdef USE_OPENSSL
@@ -4145,7 +4150,7 @@
#ifdef USE_OPENSSL
", 'ssl', 'sni'"
#endif /* USE_OPENSSL */
- " or 'linger' but got '%s' as argument.",
+ " or 'via-socks4', 'linger' but got '%s' as argument.",
args[cur_arg]);
goto error;
}