소스 검색

Update README

tags/0.9
9seconds 8 년 전
부모
커밋
f962d9c6b4
1개의 변경된 파일161개의 추가작업 그리고 4개의 파일을 삭제
  1. 161
    4
      README.md

+ 161
- 4
README.md 파일 보기

@@ -1,15 +1,172 @@
1 1
 # mtg
2 2
 
3
+Bullshit-free MTPROTO proxy for Telegram
4
+
3 5
 [![Build Status](https://travis-ci.org/9seconds/mtg.svg?branch=master)](https://travis-ci.org/9seconds/mtg)
4 6
 [![Docker Build Status](https://img.shields.io/docker/build/nineseconds/mtg.svg)](https://hub.docker.com/r/nineseconds/mtg/)
5 7
 
6
-Bullshit-free MTPROTO proxy for Telegram
7 8
 
8
-How to run:
9
+# Rationale
10
+
11
+Telegram supports proxies and proxies act as a shield for censorship
12
+and blocking actions of different goverments. At the moment of writing,
13
+Telegram supports 2 types of proxies:
14
+
15
+1. SOCKS5
16
+2. MTPROTO
17
+
18
+SOCKS5 proxy is general SOCKS proxy as defined in
19
+[RFC1928](https://www.ietf.org/rfc/rfc1928.txt). The problem is that
20
+by default SOCKS5 proxy has an access to the whole internet so a lot
21
+of people tend to hide them "just for a case". It is possible to setup
22
+SOCKS5 proxy so it is able to access just some IPs/CIDRs but, you know,
23
+yeah.
24
+
25
+MTPROTO proxy is a native Telegram proxy. It has several advantages:
26
+
27
+1. Traffic is obfuscated by AES-CTR;
28
+2. It allows connections only to Telegram services;
29
+3. It gives proxy maintainer an ability to promote its channel.
30
+
31
+But in reality, MTPROTO have 2 advantages (from my biased view):
32
+
33
+1. Obfuscation
34
+2. Simplify connection chain.
35
+
36
+Here is how it looks like to work with SOCKS5 proxy:
37
+
38
+```
39
+Client -> SOCKS -> MTPROTO -> Telegram
40
+```
41
+
42
+SOCKS5 connects to IPs of Telegram proxies. AFAIK this is because
43
+Telegram wants us to avoid censorship and regulations.
44
+
45
+What MTPROTO proxies do:
46
+
47
+```
48
+Client -> MTPROTO -> Telegram
49
+```
50
+
51
+And promoted channels. I do not tend to use them because mtg was created
52
+for slightly other way of using it but yeah. People want moneys.
53
+
54
+There are a number of unofficial proxies and one
55
+[OFFICIAL](https://github.com/TelegramMessenger/MTProxy), so why bother?
56
+
57
+<start-biased-rant>
58
+
59
+I'm a big fan of [ShadowSocks](http://www.shadowsocks.org/en/index.html)
60
+project and I like how people use it. The majority of SS proxies are
61
+disposable ones which are blocked/unblocked frequently. There are some
62
+public lists of them in Internet so if one proxy has stopped to work,
63
+you throw it out and use another one.
64
+
65
+Some SS proxies are long-living. This is because they are not public and
66
+intended to be used only by limited number of people. And single secret
67
+is fine there.
68
+
69
+What I do not get about official and some unofficial implementation is
70
+why they decided to support multiple secrets? I mean, WTF with all of
71
+you?
72
+
73
+1. MTPROTO obfuscation (called obfuscated2) does not allow to verify
74
+   client easily. You need to decrypt the frame for every secret. So, you
75
+   need a number of workers which will constantly try to crack initial
76
+   handshake frames with a list of secrets. That does not scale and will
77
+   never be.
78
+
79
+2. Why do you need a multiple secrets? Which task are you trying to
80
+   solve with them? Valid secret means only 1 thing: access to Telegram. A
81
+   binary thing. Absurd and rudimentarty access control.
82
+
83
+Okay, you want to revoke an access, thats fine. Will you ssh to the
84
+machine and restart the container? Do you want to have API for that? Web
85
+UI? Maybe store secrets in database and collect statisitcs per each?
86
+
87
+With all respect, this is idiotic thing. Guysngals, this is a proxy.
88
+Gateway to Telegram. This is not a webservice, or SASS or name that
89
+shit. This is disposable stuff. Blocked? Fine, go to the next one. Just
90
+look at ShadowSocks. There is multiple user implementation available,
91
+with control you want. Does anyone gives a flying fuck about it?
92
+
93
+> Those Who Do Not Learn History Are Doomed To Repeat It
94
+- George Santayana
95
+
96
+What I want to have?
97
+
98
+1. Minimal tool for me and my friends (which are not all my FB friends but
99
+   a limited number of close friends).
100
+2. Minimum viable configuration.
101
+3. Single artifact runnable on every platform (not always Docker, some
102
+   environments may have no Docker)
103
+4. Smallest Docker image
104
+5. Lightweight
105
+6. Have as less management as possible.
106
+
107
+</end-biased-rant>
108
+
109
+So, please do not ask for:
110
+
111
+1. Multiple users/secrets
112
+2. Web UI
113
+3. Detailed statistics/histograms etc.
114
+
115
+
116
+# How to build
117
+
118
+```console
119
+$ make
120
+```
121
+
122
+If you want to build for another platform:
123
+
124
+```console
125
+$ make crosscompile
126
+```
127
+
128
+If you want to build Docker image (called `mtg`):
129
+
130
+```console
131
+$ make docker
132
+```
133
+
134
+# Docker image
9 135
 
10 136
 ```console
11 137
 $ docker pull nineseconds/mtg
12
-$ docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 nineseconds/mtg aaabbbccc
13 138
 ```
14 139
 
15
-Reasonable README with rationale will come a bit later, sorry.
140
+# Configuration
141
+
142
+Basically, to run this tool you need to configure as less as possible.
143
+
144
+First, you need to generate a secret:
145
+
146
+```console
147
+$ openssl rand -hex 16
148
+```
149
+
150
+or
151
+
152
+```console
153
+$ head -c 512 | sha1sum | cut -f 1 -d ' '
154
+```
155
+
156
+Now run the tool:
157
+
158
+```console
159
+$ mtg <secret>
160
+```
161
+
162
+This tool will listen on port 3128 by default with the given secret.
163
+
164
+# One-line runner
165
+
166
+```
167
+$ docker run --name mtg --restart=unless-stopped -p 444:3128 -p 3129:3129 -d nineseconds/mtg -a 444 $(openssl rand -hex 16)
168
+```
169
+
170
+You will have this tool up and running on port 444. Now curl
171
+`localhost:3129` to get `tg://` links or do `docker logs mtg`. Also,
172
+port 3129 will show you some statistics if you are interested in.

Loading…
취소
저장