package proxy import ( "os" "time" "gopkg.in/yaml.v3" ) const ( ProxyConfigEnv = "PROXY_CONFIG_PATH" DefaultProxyConfigPath = "/cfg/proxy.yaml" ) type Option struct { Subscribes []string `yaml:"subscribes"` Clash []string `yaml:"clash"` Interval time.Duration `yaml:"interval"` } func LoadProxyConfig(path string) (*Option, error) { f, err := os.Open(path) if err != nil { return nil, err } defer f.Close() var opt Option return &opt, yaml.NewDecoder(f).Decode(&opt) }