瀏覽代碼

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
 # By default we use Quad9.
60
 # By default we use Quad9.
61
 doh-hostname = "9.9.9.9"
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
 # public ip addresses of the server. Actually, it is required only to
98
 # public ip addresses of the server. Actually, it is required only to
64
 # generate a correct access file. if you use default values here, mtg
99
 # generate a correct access file. if you use default values here, mtg
65
 # will try to resolve these IPs on its own.
100
 # will try to resolve these IPs on its own.

+ 9
- 8
raw_config.go 查看文件

8
 )
8
 )
9
 
9
 
10
 type rawConfig struct {
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
 		Time struct {
18
 		Time struct {
19
 			Enabled       bool   `toml:"enabled"`
19
 			Enabled       bool   `toml:"enabled"`
20
 			AllowSkewness string `toml:"allow-skewness"`
20
 			AllowSkewness string `toml:"allow-skewness"`
34
 			Telegram string `toml:"telegram"`
34
 			Telegram string `toml:"telegram"`
35
 			Default  string `toml:"default"`
35
 			Default  string `toml:"default"`
36
 		} `toml:"dialers"`
36
 		} `toml:"dialers"`
37
-		DOHHostname string `toml:"doh-hostname"`
37
+		DOHHostname string   `toml:"doh-hostname"`
38
+		Proxies     []string `toml:"proxies"`
38
 	} `toml:"network"`
39
 	} `toml:"network"`
39
 	Stats struct {
40
 	Stats struct {
40
 		StatsD struct {
41
 		StatsD struct {

Loading…
取消
儲存