From b9950a18f8f289837545a5152c2fd423717c0b48 Mon Sep 17 00:00:00 2001 From: Ramin <44315995+pkka@users.noreply.github.com> Date: Wed, 5 Dec 2018 23:34:20 +0330 Subject: [PATCH 1/3] Update README.md (#229) fix typo: standard --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3c131c..67ca9db 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Add `dd` prefix to secret (`cafe...babe` => `ddcafe...babe`) to enable this mode on client side. ## Systemd example configuration -1. Create systemd service file (it's standart path for the most Linux distros, but you should check it before): +1. Create systemd service file (it's standard path for the most Linux distros, but you should check it before): ```bash nano /etc/systemd/system/MTProxy.service ``` From 28f5b17eef2f50d768c4f010f8a4fc149254550a Mon Sep 17 00:00:00 2001 From: vvaltman Date: Fri, 25 Jan 2019 12:24:00 +0400 Subject: [PATCH 2/3] mtproto: by default do not open stats port --- mtproto/mtproto-proxy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mtproto/mtproto-proxy.c b/mtproto/mtproto-proxy.c index 9eef02b..718c6b2 100644 --- a/mtproto/mtproto-proxy.c +++ b/mtproto/mtproto-proxy.c @@ -62,6 +62,7 @@ #include "mtproto-config.h" #include "common/tl-parse.h" #include "engine/engine.h" +#include "engine/engine-net.h" #ifndef COMMIT #define COMMIT "unknown" @@ -2123,6 +2124,7 @@ void usage (void) { exit (2); } +server_functions_t mtproto_front_functions; int f_parse_option (int val) { char *colon, *ptr; switch (val) { @@ -2174,6 +2176,10 @@ int f_parse_option (int val) { ping_interval = PING_INTERVAL; } break; + case 2000: + engine_set_http_fallback (&ct_http_server, &http_methods_stats); + mtproto_front_functions.flags &= ~ENGINE_NO_PORT; + break; case 'S': case 'P': { @@ -2216,6 +2222,7 @@ int f_parse_option (int val) { } void mtfront_prepare_parse_options (void) { + parse_option ("http-stats", no_argument, 0, 2000, "allow http server to answer on stats queries"); parse_option ("mtproto-secret", required_argument, 0, 'S', "16-byte secret in hex mode"); parse_option ("proxy-tag", required_argument, 0, 'P', "16-byte proxy tag in hex mode to be passed along with all forwarded queries"); parse_option ("max-special-connections", required_argument, 0, 'C', "sets maximal number of accepted client connections per worker"); @@ -2328,7 +2335,8 @@ server_functions_t mtproto_front_functions = { .FullVersionStr = FullVersionStr, .ShortVersionStr = "mtproxy", .parse_function = mtfront_parse_function, - .http_functions = &http_methods_stats + .flags = ENGINE_NO_PORT + //.http_functions = &http_methods_stats }; int main (int argc, char *argv[]) { From 2c942119c4ee340c80922ba11d14fb3b10d5e654 Mon Sep 17 00:00:00 2001 From: vvaltman Date: Fri, 25 Jan 2019 14:41:56 +0400 Subject: [PATCH 3/3] enable stats only on 127.0.0.1 --- engine/engine-net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/engine-net.c b/engine/engine-net.c index eb9e98b..38ddd67 100644 --- a/engine/engine-net.c +++ b/engine/engine-net.c @@ -55,11 +55,10 @@ int get_port_mod (void) /* {{{ */ { int try_open_port (int port, int quit_on_fail) /* {{{ */ { engine_t *E = engine_state; - int enable_ipv6 = engine_check_ipv6_enabled () ? SM_IPV6 : 0; if (engine_check_tcp_enabled ()) { struct in_addr l; l.s_addr = htonl(0x7f000001); - E->sfd = server_socket (port, l, engine_get_backlog (), enable_ipv6); + E->sfd = server_socket (port, l, engine_get_backlog (), 0); vkprintf (1, "opened tcp socket\n"); if (E->sfd < 0) { if (quit_on_fail) {