|
@ -12,15 +12,18 @@ type yamlNetConfig struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type yamlConfig struct { |
|
|
type yamlConfig struct { |
|
|
Log string `yaml:"log"` |
|
|
|
|
|
Custom []string `yaml:"custom"` |
|
|
Custom []string `yaml:"custom"` |
|
|
Update struct { |
|
|
Update struct { |
|
|
Cron string `yaml:"cron"` |
|
|
Cron string `yaml:"cron"` |
|
|
Url map[string]string `yaml:"url"` |
|
|
Url map[string]string `yaml:"url"` |
|
|
} `yaml:"update"` |
|
|
} `yaml:"update"` |
|
|
Proxy struct { |
|
|
Proxy struct { |
|
|
Sniff bool `yaml:"sniff"` |
|
|
Log string `yaml:"log"` |
|
|
|
|
|
Sniff struct { |
|
|
|
|
|
Enable bool `yaml:"enable"` |
|
|
Redirect bool `yaml:"redirect"` |
|
|
Redirect bool `yaml:"redirect"` |
|
|
|
|
|
Exclude []string `yaml:"exclude"` |
|
|
|
|
|
} `yaml:"sniff"` |
|
|
Http map[string]int `yaml:"http"` |
|
|
Http map[string]int `yaml:"http"` |
|
|
Socks map[string]int `yaml:"socks"` |
|
|
Socks map[string]int `yaml:"socks"` |
|
|
AddOn []interface{} `yaml:"addon"` |
|
|
AddOn []interface{} `yaml:"addon"` |
|
@ -99,10 +102,12 @@ func decodeIPv6(rawConfig *yamlConfig) (string, string) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func decodeProxy(rawConfig *yamlConfig, config *Config) { |
|
|
func decodeProxy(rawConfig *yamlConfig, config *Config) { |
|
|
config.EnableSniff = rawConfig.Proxy.Sniff |
|
|
config.EnableSniff = rawConfig.Proxy.Sniff.Enable |
|
|
log.Debugf("Connection sniff -> %v", config.EnableSniff) |
|
|
log.Debugf("Connection sniff -> %t", config.EnableSniff) |
|
|
config.EnableRedirect = rawConfig.Proxy.Redirect |
|
|
config.EnableRedirect = rawConfig.Proxy.Sniff.Redirect |
|
|
log.Debugf("Connection redirect -> %v", config.EnableRedirect) |
|
|
log.Debugf("Connection redirect -> %t", config.EnableRedirect) |
|
|
|
|
|
config.SniffExclude = rawConfig.Proxy.Sniff.Exclude |
|
|
|
|
|
log.Debugf("Connection sniff exlcude -> %v", config.SniffExclude) |
|
|
config.HttpInbounds = rawConfig.Proxy.Http |
|
|
config.HttpInbounds = rawConfig.Proxy.Http |
|
|
log.Debugf("Http inbounds -> %v", config.HttpInbounds) |
|
|
log.Debugf("Http inbounds -> %v", config.HttpInbounds) |
|
|
config.SocksInbounds = rawConfig.Proxy.Socks |
|
|
config.SocksInbounds = rawConfig.Proxy.Socks |
|
@ -127,7 +132,7 @@ func decodeCustom(rawConfig *yamlConfig) []string { |
|
|
|
|
|
|
|
|
func decode(rawConfig yamlConfig) Config { |
|
|
func decode(rawConfig yamlConfig) Config { |
|
|
var config Config |
|
|
var config Config |
|
|
config.LogLevel = rawConfig.Log |
|
|
config.LogLevel = rawConfig.Proxy.Log |
|
|
config.DNS = decodeDns(&rawConfig) |
|
|
config.DNS = decodeDns(&rawConfig) |
|
|
config.V4Bypass, config.V6Bypass = decodeBypass(&rawConfig) |
|
|
config.V4Bypass, config.V6Bypass = decodeBypass(&rawConfig) |
|
|
config.V4Address, config.V4Gateway = decodeIPv4(&rawConfig) |
|
|
config.V4Address, config.V4Gateway = decodeIPv4(&rawConfig) |
|
|