8 커밋

작성자 SHA1 메시지 날짜
  Sergei Arkhipov c8cc317b48
Merge pull request #487 from bam80/podman 3 주 전
  Sergei Arkhipov 83c0c8acfb
Merge pull request #491 from bam80/localhost 3 주 전
  Sergei Arkhipov b0923a51d2
Merge pull request #488 from dolonet/doctor/skip-native-check-v2 3 주 전
  Sergei Arkhipov 31c31c50c0
Merge pull request #481 from dolonet/docs/link-example-config 3 주 전
  Andrey Butirsky faaa75612f compose: mtg: add hostname for host access from container 4 주 전
  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,9 +384,14 @@ files.
384 384
 
385 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 396
 ```toml
392 397
 secret = "ee473ce5d4958eb5f968c87680a23854a0676f6f676c652e636f6d"
@@ -396,8 +401,6 @@ bind-to = "0.0.0.0:443"
396 401
 This is enough to run the whole application. All other
397 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 404
 ### Run a proxy
402 405
 
403 406
 Put a binary and a config into your webserver. Just for example,
@@ -467,8 +470,8 @@ $ docker exec mtg-proxy /mtg access /config.toml
467 470
 
468 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 476
 mtg comes with some very good precollected statistics coming from
474 477
 [ok.ru](https://ok.ru/). It does not mean that you have to cover yourself
@@ -562,8 +565,9 @@ There are three ways to resolve it:
562 565
 
563 566
 Out of the box, mtg works with
564 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 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,26 +23,30 @@ services:
23 23
       - "443:443"
24 24
       - "80:80"
25 25
     volumes:
26
-      - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
26
+      - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro,Z
27 27
     depends_on:
28 28
       - mtg
29 29
       - web
30 30
     restart: unless-stopped
31
+    sysctls:
32
+      - net.ipv4.ip_unprivileged_port_start=80
31 33
 
32 34
   mtg:
33 35
     image: nineseconds/mtg:2
34 36
     volumes:
35
-      - ./mtg-config.toml:/config/config.toml:ro
37
+      - ./mtg-config.toml:/config/config.toml:ro,Z
36 38
     expose:
37 39
       - "3128"
38 40
     restart: unless-stopped
41
+    extra_hosts:
42
+      - "host.containers.internal:host-gateway"
39 43
 
40 44
   web:
41 45
     image: caddy:alpine
42 46
     volumes:
43
-      - ./Caddyfile:/etc/caddy/Caddyfile:ro
47
+      - ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
44 48
       - caddy_data:/data
45
-      - ./www:/srv:ro
49
+      - ./www:/srv:ro,Z
46 50
     expose:
47 51
       - "80"
48 52
       - "8443"

+ 7
- 2
internal/cli/doctor.go 파일 보기

@@ -69,7 +69,8 @@ var (
69 69
 type Doctor struct {
70 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 76
 func (d *Doctor) Run(cli *CLI, version string) error {
@@ -106,7 +107,11 @@ func (d *Doctor) Run(cli *CLI, version string) error {
106 107
 	)
107 108
 
108 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 116
 	for _, url := range conf.Network.Proxies {
112 117
 		value, err := network.NewProxyNetwork(base, url.Get(nil))

Loading…
취소
저장