@@ -38,6 +38,33 @@ goal: to give a possibility to connect to Telegram in a restricted,
3838censored environment. But it does it slightly differently in details
3939that probably matter.
4040
41+ * ** Domain fronting**
42+
43+ For years mtg supports domain fronting. This technique means that it fallbacks
44+ to accessing a real website in case if request fails. It could fail by many
45+ reasons: anti-replay protection, accidental access to the webserver or
46+ stale request. Anyway, if mtg rejects this request, it does not break a
47+ connection. It connects to the websites and replicates everything that client
48+ has sent, and simply proxies it back as is. Users will see a response from
49+ the real website, _ byte-to-byte identical_ to the response of the real netloc.
50+
51+ * ** Doppelganger**
52+
53+ mtg also is a doppelganger of the website it fronts. Sure, with domain fronting
54+ users will see replies of the real website in case if something will go wrong.
55+ But what about such cases when _ everything is fine_ ?
56+
57+ In that case mtg mimics TLS connection statistical characteristics as close as
58+ possible. Different application have different statistics of their patterns.
59+ Big CDN steadily pumping the data, small websites burst with short easily
60+ compressiable chunks of traffic.
61+
62+ mtg artificially emulates those delays to be statistically indistinguishable
63+ from the real website even if it covers connection of the very specific app.
64+ It also follows 2 most common patterns of traffic chunking, so censors
65+ will have to put more resources to find out that we have Telegram here
66+ but not a hookah webshop served by nginx.
67+
4168* ** Resource-efficient**
4269
4370 It has to be resource-efficient. It does not mean that you will see
@@ -93,6 +120,8 @@ that probably matter.
93120 software (written in Golang) with a minimum effort + you can replace
94121 some parts with those you want.
95122
123+ Please also to read about [ best practices] ( https://github.com/9seconds/mtg/blob/master/BEST_PRACTICES.md ) .
124+
96125### Version 2
97126
98127If you use version 1.x before, you are probably noticed some major
@@ -398,6 +427,55 @@ or if you are using docker:
398427$ docker exec mtg-proxy /mtg access /config.toml
399428```
400429
430+ ## Doppelganger
431+
432+ mtg can mimic real websites, please take a look at relevant section in example
433+ config file.
434+
435+ mtg comes with some very good precollected statistics coming from
436+ [ ok.ru] ( https://ok.ru/ ) . It does not mean that you have to cover yourself
437+ by pretending that mtg is _ ok.ru_ . ** Do not do that: ok.ru comes from very specific
438+ ASNs, but not from VPS providers you are going to use.** What I want to say
439+ is that defaults are very good enough to use as is because ok.ru for public
440+ pages has a very generic profile of TLS packets delay.
441+
442+ But for better results it is recommended to teach mtg about the website you
443+ will use as a domain front. In order to do that, you need to specify URLs
444+ from this website. Just go to it, open WebDeveloper console and pick up
445+ random URLs. For better results they have to be ** from the same domain name
446+ you are going to use as a disguise** but serve light and heavy content: pages,
447+ images etc. Do not use many, 2-3 will probably work.
448+
449+ mtg will crawl these pages periodically, accumulating statistics and
450+ using it as you go.
451+
452+ ``` toml
453+ [defense .doppelganger ]
454+ urls = [
455+ " https://lalala.com/index.html" ,
456+ " https://lalala.com/contacts.html" ,
457+ ]
458+ ```
459+
460+ This is not very necessary. Keep in mind these rules:
461+
462+ 1 . If you are not sure what is this all about, do nothing. Defaults are good.
463+ 2 . All URLs must be HTTPS
464+ 3 . All URLs should be from the same domain name (but this is not a rule)
465+ 4 . Do not use a lot of pages. Use _ different_ pages. mtg will start using this
466+ statistics when it will accumulate enough anyway.
467+ 5 . These URLs should be directly accessible from mtg without proxies whatsoever
468+ 6 . Do not create huge raids. mtg will repeatedly crawl in raids, making N repeats.
469+ Do not use high N, you do not want to be noticeable.
470+ 7 . It makes no sense to have small delay between raids. Usually webservers
471+ do not update their TLS settings each hour.
472+ 8 . If you have some specific knowledge if webserver is using
473+ [ TLS Dynamic Record Sizing] ( https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency/ ) , you
474+ can use a very specific setting. This are Cloudflare, Go standard webservers,
475+ [ caddy] ( https://caddyserver.com/ ) and [ H2O] ( https://h2o.examp1e.net/ ) . If so,
476+ you can enable ` drs ` setting.
477+ 9 . ** If you are not sure, touch nothing!**
478+
401479## Metrics
402480
403481Out of the box, mtg works with
0 commit comments