mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 15:44:01 +03:00
Propagate keep alive settings from the config
This commit is contained in:
@@ -97,6 +97,12 @@ func (d *Doctor) Run(cli *CLI, version string) error {
|
||||
conf.Network.Timeout.TCP.Get(10*time.Second),
|
||||
conf.Network.Timeout.HTTP.Get(0),
|
||||
conf.Network.Timeout.Idle.Get(0),
|
||||
net.KeepAliveConfig{
|
||||
Enable: !conf.Network.KeepAlive.Disabled.Get(false),
|
||||
Idle: conf.Network.KeepAlive.Idle.Get(0),
|
||||
Interval: conf.Network.KeepAlive.Interval.Get(0),
|
||||
Count: int(conf.Network.KeepAlive.Count.Get(0)),
|
||||
},
|
||||
)
|
||||
|
||||
fmt.Println("Validate native network connectivity")
|
||||
|
||||
@@ -50,6 +50,12 @@ func makeNetwork(conf *config.Config, version string) (mtglib.Network, error) {
|
||||
conf.Network.Timeout.TCP.Get(0),
|
||||
conf.Network.Timeout.HTTP.Get(0),
|
||||
conf.Network.Timeout.Idle.Get(0),
|
||||
net.KeepAliveConfig{
|
||||
Enable: !conf.Network.KeepAlive.Disabled.Get(false),
|
||||
Idle: conf.Network.KeepAlive.Idle.Get(0),
|
||||
Interval: conf.Network.KeepAlive.Interval.Get(0),
|
||||
Count: int(conf.Network.KeepAlive.Count.Get(0)),
|
||||
},
|
||||
)
|
||||
|
||||
proxyDialers := make([]mtglib.Network, len(conf.Network.Proxies))
|
||||
|
||||
@@ -65,6 +65,12 @@ type Config struct {
|
||||
Idle TypeDuration `json:"idle"`
|
||||
Handshake TypeDuration `json:"handshake"`
|
||||
} `json:"timeout"`
|
||||
KeepAlive struct {
|
||||
Disabled TypeBool `json:"disabled"`
|
||||
Idle TypeDuration `json:"idle"`
|
||||
Interval TypeDuration `json:"interval"`
|
||||
Count TypeConcurrency `json:"count"`
|
||||
} `json:"keepAlive"`
|
||||
DOHIP TypeIP `json:"dohIp"`
|
||||
DNS TypeDNSURI `json:"dns"`
|
||||
Proxies []TypeProxyURL `json:"proxies"`
|
||||
|
||||
@@ -60,6 +60,12 @@ type tomlConfig struct {
|
||||
Idle string `toml:"idle" json:"idle,omitempty"`
|
||||
Handshake string `toml:"handshake" json:"handshake,omitempty"`
|
||||
} `toml:"timeout" json:"timeout,omitempty"`
|
||||
KeepAlive struct {
|
||||
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
|
||||
Idle string `toml:"idle" json:"idle,omitempty"`
|
||||
Interval string `toml:"interval" json:"interval,omitempty"`
|
||||
Count uint `toml:"count" json:"count,omitempty"`
|
||||
} `toml:"keep-alive" json:"keepAlive,omitempty"`
|
||||
DOHIP string `toml:"doh-ip" json:"dohIp,omitempty"`
|
||||
DNS string `toml:"dns" json:"dns,omitempty"`
|
||||
Proxies []string `toml:"proxies" json:"proxies,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user