8 コミット

作成者 SHA1 メッセージ 日付
  Sergei Arkhipov c8cc317b48
Merge pull request #487 from bam80/podman 1ヶ月前
  Sergei Arkhipov 83c0c8acfb
Merge pull request #491 from bam80/localhost 1ヶ月前
  Sergei Arkhipov b0923a51d2
Merge pull request #488 from dolonet/doctor/skip-native-check-v2 1ヶ月前
  Sergei Arkhipov 31c31c50c0
Merge pull request #481 from dolonet/docs/link-example-config 1ヶ月前
  Andrey Butirsky faaa75612f compose: mtg: add hostname for host access from container 1ヶ月前
  Andrey Butirsky d87f91fe8c add support for unprivileged podman container 1ヶ月前
  dolonet 49ac70066f doctor: add --skip-native-check flag 1ヶ月前
  Alexey Dolotov fc0ab916bc docs: link example.config.toml as the config reference 1ヶ月前
3個のファイルの変更28行の追加15行の削除
  1. 13
    9
      README.md
  2. 8
    4
      contrib/sni-router/docker-compose.yml
  3. 7
    2
      internal/cli/doctor.go

+ 13
- 9
README.md ファイルの表示

384
 
384
 
385
 ### Prepare a configuration file
385
 ### Prepare a configuration file
386
 
386
 
387
-Please checkout an example configuration file. All options except of
388
-`secret` and `bind-to` are optional. You can safely have this minimal
389
-configuration file:
387
+mtg is configured via a [TOML](https://toml.io/en/) file. The full
388
+reference is [`example.config.toml`](./example.config.toml) in this
389
+repository — every option is listed there with its default value and
390
+an inline comment explaining what it does. Treat that file as the
391
+configuration documentation.
392
+
393
+All options except `secret` and `bind-to` are optional, so the minimal
394
+working configuration is:
390
 
395
 
391
 ```toml
396
 ```toml
392
 secret = "ee473ce5d4958eb5f968c87680a23854a0676f6f676c652e636f6d"
397
 secret = "ee473ce5d4958eb5f968c87680a23854a0676f6f676c652e636f6d"
396
 This is enough to run the whole application. All other
401
 This is enough to run the whole application. All other
397
 options already have sensible defaults for the app at almost any scale.
402
 options already have sensible defaults for the app at almost any scale.
398
 
403
 
399
-Oh, the configuration is done in [TOML format](https://toml.io/en/).
400
-
401
 ### Run a proxy
404
 ### Run a proxy
402
 
405
 
403
 Put a binary and a config into your webserver. Just for example,
406
 Put a binary and a config into your webserver. Just for example,
467
 
470
 
468
 ## Doppelganger
471
 ## Doppelganger
469
 
472
 
470
-mtg can mimic real websites, please take a look at relevant section in example
471
-config file.
473
+mtg can mimic real websites — see the `[defense.doppelganger]` section
474
+in [`example.config.toml`](./example.config.toml).
472
 
475
 
473
 mtg comes with some very good precollected statistics coming from
476
 mtg comes with some very good precollected statistics coming from
474
 [ok.ru](https://ok.ru/). It does not mean that you have to cover yourself
477
 [ok.ru](https://ok.ru/). It does not mean that you have to cover yourself
562
 
565
 
563
 Out of the box, mtg works with
566
 Out of the box, mtg works with
564
 [statsd](https://github.com/statsd/statsd) and
567
 [statsd](https://github.com/statsd/statsd) and
565
-[Prometheus](https://prometheus.io/). Please check configuration file
566
-example to get how to set this integration up.
568
+[Prometheus](https://prometheus.io/). See the `[stats.statsd]` and
569
+`[stats.prometheus]` sections in
570
+[`example.config.toml`](./example.config.toml) for setup.
567
 
571
 
568
 Here goes a list of metrics with their types but without a prefix.
572
 Here goes a list of metrics with their types but without a prefix.
569
 
573
 

+ 8
- 4
contrib/sni-router/docker-compose.yml ファイルの表示

23
       - "443:443"
23
       - "443:443"
24
       - "80:80"
24
       - "80:80"
25
     volumes:
25
     volumes:
26
-      - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
26
+      - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro,Z
27
     depends_on:
27
     depends_on:
28
       - mtg
28
       - mtg
29
       - web
29
       - web
30
     restart: unless-stopped
30
     restart: unless-stopped
31
+    sysctls:
32
+      - net.ipv4.ip_unprivileged_port_start=80
31
 
33
 
32
   mtg:
34
   mtg:
33
     image: nineseconds/mtg:2
35
     image: nineseconds/mtg:2
34
     volumes:
36
     volumes:
35
-      - ./mtg-config.toml:/config/config.toml:ro
37
+      - ./mtg-config.toml:/config/config.toml:ro,Z
36
     expose:
38
     expose:
37
       - "3128"
39
       - "3128"
38
     restart: unless-stopped
40
     restart: unless-stopped
41
+    extra_hosts:
42
+      - "host.containers.internal:host-gateway"
39
 
43
 
40
   web:
44
   web:
41
     image: caddy:alpine
45
     image: caddy:alpine
42
     volumes:
46
     volumes:
43
-      - ./Caddyfile:/etc/caddy/Caddyfile:ro
47
+      - ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
44
       - caddy_data:/data
48
       - caddy_data:/data
45
-      - ./www:/srv:ro
49
+      - ./www:/srv:ro,Z
46
     expose:
50
     expose:
47
       - "80"
51
       - "80"
48
       - "8443"
52
       - "8443"

+ 7
- 2
internal/cli/doctor.go ファイルの表示

69
 type Doctor struct {
69
 type Doctor struct {
70
 	conf *config.Config
70
 	conf *config.Config
71
 
71
 
72
-	ConfigPath string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
72
+	ConfigPath      string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
73
+	SkipNativeCheck bool   `kong:"help='Skip the native network connectivity check (useful when proxy chaining is configured and direct egress is not expected to work).',name='skip-native-check'"` //nolint: lll
73
 }
74
 }
74
 
75
 
75
 func (d *Doctor) Run(cli *CLI, version string) error {
76
 func (d *Doctor) Run(cli *CLI, version string) error {
106
 	)
107
 	)
107
 
108
 
108
 	fmt.Println("Validate native network connectivity")
109
 	fmt.Println("Validate native network connectivity")
109
-	everythingOK = d.checkNetwork(base) && everythingOK
110
+	if d.SkipNativeCheck {
111
+		fmt.Println("  ⏭ Skipped (--skip-native-check)")
112
+	} else {
113
+		everythingOK = d.checkNetwork(base) && everythingOK
114
+	}
110
 
115
 
111
 	for _, url := range conf.Network.Proxies {
116
 	for _, url := range conf.Network.Proxies {
112
 		value, err := network.NewProxyNetwork(base, url.Get(nil))
117
 		value, err := network.NewProxyNetwork(base, url.Get(nil))

読み込み中…
キャンセル
保存