47 Commits
Author SHA1 Message Date
ScuroNeko 98aa31b5f5 removed unwanted log write
doctor logging per-ip
2026-04-20 13:45:03 +03:00
ScuroNeko c80d3452f0 support for test dc1-3
loading custom dc ips from config
2026-04-20 13:04:13 +03:00
dolonet 68a4685ec6 Fix description of blocklist rejection behavior
The previous wording ("silently routed to the fronting domain")
is inaccurate. In mtglib/proxy.go the blocklist path calls
conn.Close() immediately with no further handshake or fronting;
domain fronting only happens on FakeTLS failures for non-blocked
IPs. Reword to "TCP connection is closed with no response" so
users searching the docs get the same symptom they actually see.
2026-04-13 07:46:52 +00:00
dolonet 602f85d24d Document firehol_level1 RFC1918 gotcha in blocklist defaults
The default [defense.blocklist] uses firehol_level1.netset, which
includes bogon networks and therefore all RFC1918 ranges. Clients
connecting from a LAN address (e.g. a phone on the home Wi-Fi when
mtg runs at home) are silently rejected with "ip was blacklisted"
and routed to the fronting domain. This is a recurring source of
confusion (see issue #466 for the latest example).

Add a warning next to the urls list in example.config.toml and a
Troubleshooting section in README.md covering the symptom, the
cause, and three resolution paths (disable blocklist, swap for a
narrower list, or use hairpin NAT).

Docs only, no code changes.
2026-04-13 07:08:08 +00:00
9seconds 102f8a6cce Propagate keep alive settings from the config 2026-04-07 13:41:44 +02:00
9seconds eb564936c7 Add separate handshake timeout
This PR adds a new setting to the config: `network.timeout`. This setting
defines a time period during which all handshake procedures and
ceremonies must be completed. If not - connection is aborted. This
should help in situations when connection is established but client
cannot continue for some reason (for example, RST sent by some middle box).
2026-04-07 08:01:51 +02:00
appolimp 5f81ae3743 Improve TCP keepalive and idle timeout for mobile clients
TCP keepalive was configured (SetKeepAlivePeriod) but never actually
enabled (SO_KEEPALIVE) on accepted client connections. Go 1.26's
SetKeepAlivePeriod only sets TCP_KEEPIDLE — it does not call
setsockopt(SO_KEEPALIVE, 1). Without SO_KEEPALIVE the kernel never
sends probe packets, so dead connections from sleeping mobile clients
linger until the idle timeout fires.

Replace SetKeepAlive + SetKeepAlivePeriod with net.KeepAliveConfig
(available since Go 1.24) for explicit per-socket control:

  Idle:     30s   (time before first probe)
  Interval: 10s   (between probes)
  Count:    3     (failed probes to declare dead)

This detects dead connections in ~60s instead of relying on system
defaults (tcp_keepalive_intvl=75s, probes=9 → up to 11 minutes).

Increase the default idle timeout from 1 minute to 5 minutes.
MTProto clients send ping_delay_disconnect every ~60s, which resets
the idle timer. The previous 1-minute default created a race: if a
ping arrived even 1–2 seconds late the relay was killed. A 5-minute
window also survives typical mobile sleep periods (phone idle 2–5 min)
where the NAT mapping is still alive and the connection can resume
without reconnection.

Ref: #132
2026-04-04 12:01:33 +03:00
Alexey Dolotov 2b07c0037e Add public-ipv4/public-ipv6 config options for manual IP override
On some servers ifconfig.co is unreachable (e.g. Hetzner, AdGuard DNS
blocklists), causing 'mtg doctor' SNI-DNS check and 'mtg access' link
generation to fail. New config options allow specifying public IPs
manually, with automatic detection as fallback.

Fixes #405
2026-03-29 00:47:49 +03:00
9seconds 21d7522356 Make DRS optional 2026-03-13 11:04:01 +01:00
9seconds 5557393b38 Add config section 2026-03-12 19:07:11 +01:00
9seconds 23aa2eefad More details on DOH-IP option 2026-02-28 14:50:48 +01:00
9seconds ddc34bf918 Comment out doh-ip 2026-02-28 14:48:37 +01:00
9seconds 897e6bf505 Propagate DNS setting to configuration 2026-02-27 16:23:24 +01:00
9seconds 189dce07c6 Make auto updating optional 2026-02-26 13:35:05 +01:00
9seconds 1cb225f52c Introduce [domain-fronting] config 2026-02-24 18:05:12 +01:00
9seconds af72b2a574 Delete obsoleted setting 2026-02-24 16:56:42 +01:00
9seconds cde313b359 Add support for domain fronting proxy protocol 2026-02-24 16:44:35 +01:00
9seconds 8b34c1b104 Merge remote-tracking branch 'origin/master' into obfuscated2 2026-02-24 13:37:10 +01:00
9seconds e4a9a96309 Remove mentioning of DC overrides 2026-02-24 13:32:06 +01:00
ivulit 21129b6e00 Add domain-fronting-ip to example config 2026-02-20 12:34:22 +03:00
9seconds cf3437bb63 Add support of proxy protocol 2026-02-19 14:22:00 +01:00
9seconds 36546cec2f Change default DOH to cloudflarte 2026-02-16 17:18:31 +01:00
9seconds 8e87405d3e Remove integration with gotd 2026-02-16 16:30:10 +01:00
9seconds 82679ec20f Update config 2026-02-16 15:22:03 +01:00
9seconds 30170b9413 Add iplist_size metric 2022-03-11 16:20:11 +03:00
Sergey ArkhipovandGitHub 3f8f96b91f Merge pull request #230 from 9seconds/simplify-sockopts
Simplify sockopts
2021-12-01 16:03:52 +04:00
9seconds 0ddaabb136 Add whitelist support 2021-11-29 17:02:53 +03:00
9seconds 4c75066ef8 Update configuration 2021-11-29 05:35:37 +03:00
9seconds cd29f3e20b Add configuration option allow-fallback-on-unknown-dc 2021-10-04 14:42:26 +03:00
9seconds e2073f0585 Remove timeattack module 2021-04-08 14:58:14 +03:00
9seconds 5d5b77d73b Tune defaults 2021-04-02 21:58:22 +03:00
9seconds 5eca6ecb05 Validate hostname if it was found in SNI 2021-03-26 17:23:30 +03:00
9seconds bddf180575 Implement domain fronting 2021-03-26 14:45:00 +03:00
9seconds 46bd617581 Add tags for statsd in config 2021-03-16 17:28:06 +03:00
9seconds 37a78bd1c3 More reasonable cli for access 2021-03-13 21:30:57 +03:00
9seconds 1f862027af Add blocklist to config 2021-03-12 16:53:15 +03:00
9seconds 02643fb6bb Add concurrency parameter 2021-03-12 16:21:52 +03:00
9seconds e167b85d3b Add HTTP timeout 2021-03-12 16:19:52 +03:00
9seconds c0b6124d94 Add tests for configuration parsing 2021-03-12 15:34:32 +03:00
9seconds 24add0dce4 Make network as a separae interface 2021-03-11 04:57:07 +03:00
9seconds cbcc113e41 Add cli command for access 2021-03-10 16:59:19 +03:00
9seconds d1dd56550f Add correct configuration 2021-03-10 14:42:24 +03:00
9seconds e0833e86d9 Update configuration file with proxies specification 2021-03-10 11:12:10 +03:00
9seconds f89f5f8469 Remove access-file 2021-03-10 11:03:23 +03:00
9seconds 09f8233bc6 Modify config 2021-03-05 16:17:34 +03:00
9seconds 4689479745 Add base dialers module 2021-03-05 12:20:57 +03:00
9seconds 2be900745f Add example of configuration file 2021-03-04 14:13:08 +03:00