mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 18:24:02 +03:00
Add Config.GetConcurrency with default fallback
This commit is contained in:
@@ -253,6 +253,7 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
|
||||
EventStream: eventStream,
|
||||
|
||||
Secret: conf.Secret,
|
||||
Concurrency: conf.GetConcurrency(mtglib.DefaultConcurrency),
|
||||
DomainFrontingPort: conf.GetDomainFrontingPort(mtglib.DefaultDomainFrontingPort),
|
||||
DomainFrontingIP: conf.GetDomainFrontingIP(nil),
|
||||
DomainFrontingProxyProtocol: conf.GetDomainFrontingProxyProtocol(false),
|
||||
|
||||
@@ -84,6 +84,13 @@ type Config struct {
|
||||
} `json:"stats"`
|
||||
}
|
||||
|
||||
func (c *Config) GetConcurrency(defaultValue uint) uint {
|
||||
if concurrency := c.Concurrency.Get(0); concurrency != 0 {
|
||||
return concurrency
|
||||
}
|
||||
return c.Concurrency.Get(defaultValue)
|
||||
}
|
||||
|
||||
func (c *Config) GetDNS() *url.URL {
|
||||
var dohURL *url.URL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user