README fixed and updated

parent d5d8b0d9
...@@ -18,7 +18,7 @@ Features ...@@ -18,7 +18,7 @@ Features
* Protection from [replay attacks](https://habr.com/ru/post/452144/) used to detect proxies in some countries * Protection from [replay attacks](https://habr.com/ru/post/452144/) used to detect proxies in some countries
* Automatic telegram configuration reload (no need for restarts once per day) * Automatic telegram configuration reload (no need for restarts once per day)
* Most of the configuration options can be updated without service restart * Most of the configuration options can be updated without service restart
* Small codebase compared to official one * Small codebase compared to official one, code is covered by automated tests
* A lots of metrics could be exported (optional) * A lots of metrics could be exported (optional)
How to start - docker How to start - docker
...@@ -36,7 +36,7 @@ docker run -d --network=host seriyps/mtproto-proxy ...@@ -36,7 +36,7 @@ docker run -d --network=host seriyps/mtproto-proxy
docker run -d --network=host seriyps/mtproto-proxy -p 443 -s d0d6e111bada5511fcce9584deadbeef -t dcbe8f1493fa4cd9ab300891c0b5b326 docker run -d --network=host seriyps/mtproto-proxy -p 443 -s d0d6e111bada5511fcce9584deadbeef -t dcbe8f1493fa4cd9ab300891c0b5b326
``` ```
or via environmet variables or via environment variables
```bash ```bash
docker run -d --network=host -e MTP_PORT=443 -e MTP_SECRET=d0d6e111bada5511fcce9584deadbeef -e MTP_TAG=dcbe8f1493fa4cd9ab300891c0b5b326 seriyps/mtproto-proxy docker run -d --network=host -e MTP_PORT=443 -e MTP_SECRET=d0d6e111bada5511fcce9584deadbeef -e MTP_TAG=dcbe8f1493fa4cd9ab300891c0b5b326 seriyps/mtproto-proxy
...@@ -64,6 +64,8 @@ your server's OS (see below). ...@@ -64,6 +64,8 @@ your server's OS (see below).
How to start OS-install - quick How to start OS-install - quick
----------------------------------- -----------------------------------
You need at least Erlang version 20! Recommended OS is Ubuntu 18.04.
```bash ```bash
sudo apt install erlang-nox erlang-dev build-essential sudo apt install erlang-nox erlang-dev build-essential
git clone https://github.com/seriyps/mtproto_proxy.git git clone https://github.com/seriyps/mtproto_proxy.git
...@@ -159,15 +161,15 @@ Logs can be found at ...@@ -159,15 +161,15 @@ Logs can be found at
Settings Settings
-------- --------
All possible documanted configuration options could be found All available documented configuration options could be found
in `src/mtproto_proxy.app.src`. Do not edit this file! in [src/mtproto_proxy.app.src](src/mtproto_proxy.app.src). Do not edit this file!
To change configuration, edit `config/prod-sys.config`: To change configuration, edit `config/prod-sys.config`:
Comments in this file start from `%%`. Comments in this file start with `%%`.
Default port is 1443 and default secret is `d0d6e111bada5511fcce9584deadbeef`. Default port is 1443 and default secret is `d0d6e111bada5511fcce9584deadbeef`.
Secret key and proxy URL will be printed on start. Secret key and proxy URLs will be printed on start.
The easiest way to update config right now is to edit `config/prod-sys.config` The easiest way to update config right now is to edit `config/prod-sys.config`
and then re-install proxy by and then re-install proxy by
...@@ -186,7 +188,6 @@ To change default settings, change `mtproto_proxy` section of `prod-sys.config` ...@@ -186,7 +188,6 @@ To change default settings, change `mtproto_proxy` section of `prod-sys.config`
```erlang ```erlang
{mtproto_proxy, {mtproto_proxy,
%% see src/mtproto_proxy.app.src for examples. %% see src/mtproto_proxy.app.src for examples.
%% DO NOT EDIT src/mtproto_proxy.app.src!!!
[ [
{ports, {ports,
[#{name => mtp_handler1, [#{name => mtp_handler1,
...@@ -210,7 +211,6 @@ To do so, just add more configs to `ports` section, separated by comma, eg: ...@@ -210,7 +211,6 @@ To do so, just add more configs to `ports` section, separated by comma, eg:
```erlang ```erlang
{mtproto_proxy, {mtproto_proxy,
%% see src/mtproto_proxy.app.src for examples. %% see src/mtproto_proxy.app.src for examples.
%% DO NOT EDIT src/mtproto_proxy.app.src!!!
[ [
{ports, {ports,
[#{name => mtp_handler_1, [#{name => mtp_handler_1,
...@@ -253,19 +253,20 @@ If your server have low amount of RAM, try to set ...@@ -253,19 +253,20 @@ If your server have low amount of RAM, try to set
```erlang ```erlang
{upstream_socket_buffer_size, 5120}, {upstream_socket_buffer_size, 5120},
{downstream_socket_buffer_size, 51200}, {downstream_socket_buffer_size, 51200},
{replay_checks_enabled, []}, {replay_check_session_storage, off},
``` ```
this may make proxy slower, it can start consume more CPU, will be vulnerable to replay attacks, this may make proxy slower, it can start to consume bit more CPU, will be vulnerable to replay attacks,
but will use less RAM. but will use less RAM.
If your server have lots of RAM, you can make it faster (users will get higher uppload/download speed), If your server have lots of RAM, you can make it faster (users will get higher uppload/download speed),
it will use less CPU and will be better protected from replay attacks, but will use more RAM: it will use less CPU and will be better protected from replay attacks, but will use more RAM:
```erlang ```erlang
{max_connections, 128000},
{upstream_socket_buffer_size, 20480}, {upstream_socket_buffer_size, 20480},
{downstream_socket_buffer_size, 512000}, {downstream_socket_buffer_size, 512000},
{replay_checks_enabled, [mtp_session_storage]}, {replay_check_session_storage, on},
{replay_check_session_storage_opts, {replay_check_session_storage_opts,
#{max_memory_mb => 2048, #{max_memory_mb => 2048,
max_age_minutes => 1440}}, max_age_minutes => 1440}},
...@@ -281,6 +282,13 @@ sudo sysctl 'net.ipv4.tcp_mem=179200 256000 384000' ...@@ -281,6 +282,13 @@ sudo sysctl 'net.ipv4.tcp_mem=179200 256000 384000'
Values for `tcp_mem` are in pages. Size of one page can be found by `getconf PAGESIZE` and is most Values for `tcp_mem` are in pages. Size of one page can be found by `getconf PAGESIZE` and is most
likely 4kb. likely 4kb.
If you have installed proxy via Docker or use some NAT firewall settings, you may want to increase
netfilter conntrack limits to be at least the max number of connections you expect:
```
sudo sysctl net.netfilter.nf_conntrack_max=128000
```
Helpers Helpers
------- -------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment