瀏覽代碼

Update configuration file with proxies specification

tags/v2.0.0-rc1
9seconds 5 年之前
父節點
當前提交
e0833e86d9
共有 2 個檔案被更改,包括 44 行新增8 行删除
  1. 35
    0
      example.config.toml
  2. 9
    8
      raw_config.go

+ 35
- 0
example.config.toml 查看文件

@@ -60,6 +60,41 @@ cloak-port = 443
60 60
 # By default we use Quad9.
61 61
 doh-hostname = "9.9.9.9"
62 62
 
63
+# mtg can work via proxies (for now, we support only socks5). Proxy
64
+# configuration is done via list. So, you can specify many proxies
65
+# there.
66
+#
67
+# Actually, if you supply an empty list, then no proxies are going to be
68
+# used. If you supply a single proxy, then mtg will use it exclusively.
69
+# If you supply >= 2, then mtg will load balance between them.
70
+#
71
+# If you add an empty string here, this is an equivalent of 'plain network',
72
+# with no proxy usage.
73
+#
74
+# Proxy configuration is done via ordinary URI schema:
75
+#
76
+#     socks5://user:password@host:port?open_threshold=5&half_open_timeout=1m&reset_failures_timeout=10s
77
+#
78
+
79
+# Only socks5 proxy is used. user/password is optional. As you can
80
+# see, you can specify some parameters in GET query. These parameters
81
+# configure circuit breaker.
82
+#
83
+# open_threshold means a number of errors which should happen so we stop
84
+# use a proxy.
85
+#
86
+# half_open_timeout means a time period (in Golang duration notation)
87
+# after which we can retry with this proxy
88
+#
89
+# reset_failures_timeout means a time period when we flush out errors
90
+# when circuit breaker in closed state.
91
+#
92
+# Please see https://docs.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker
93
+# on details about circuit breakers.
94
+proxies = [
95
+    # "socks5://user:password@host:port?open_threshold=5&half_open_timeout=1m&reset_failures_timeout=10s"
96
+]
97
+
63 98
 # public ip addresses of the server. Actually, it is required only to
64 99
 # generate a correct access file. if you use default values here, mtg
65 100
 # will try to resolve these IPs on its own.

+ 9
- 8
raw_config.go 查看文件

@@ -8,13 +8,13 @@ import (
8 8
 )
9 9
 
10 10
 type rawConfig struct {
11
-	Debug      bool   `toml:"debug"`
12
-	Secret     string `toml:"secret"`
13
-	BindTo     string `toml:"bind-to"`
14
-	TCPBuffer  string `toml:"tcp-buffer"`
15
-	PreferIP   string `toml:"prefer-ip"`
16
-	CloakPort  uint   `toml:"cloak-port"`
17
-	Probes     struct {
11
+	Debug     bool   `toml:"debug"`
12
+	Secret    string `toml:"secret"`
13
+	BindTo    string `toml:"bind-to"`
14
+	TCPBuffer string `toml:"tcp-buffer"`
15
+	PreferIP  string `toml:"prefer-ip"`
16
+	CloakPort uint   `toml:"cloak-port"`
17
+	Probes    struct {
18 18
 		Time struct {
19 19
 			Enabled       bool   `toml:"enabled"`
20 20
 			AllowSkewness string `toml:"allow-skewness"`
@@ -34,7 +34,8 @@ type rawConfig struct {
34 34
 			Telegram string `toml:"telegram"`
35 35
 			Default  string `toml:"default"`
36 36
 		} `toml:"dialers"`
37
-		DOHHostname string `toml:"doh-hostname"`
37
+		DOHHostname string   `toml:"doh-hostname"`
38
+		Proxies     []string `toml:"proxies"`
38 39
 	} `toml:"network"`
39 40
 	Stats struct {
40 41
 		StatsD struct {

Loading…
取消
儲存