diff --git a/README.md b/README.md index 402fe7a6..377d5447 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,6 @@ proxies: password: "password" # udp: true - # old obfs configuration format remove after prerelease - name: "ss2" type: ss server: server @@ -368,8 +367,6 @@ rules: - GEOIP,CN,DIRECT - DST-PORT,80,DIRECT - SRC-PORT,7777,DIRECT - # FINAL would remove after prerelease - # you also can use `FINAL,Proxy` or `FINAL,,Proxy` now - MATCH,auto ``` diff --git a/adapters/outbound/shadowsocks.go b/adapters/outbound/shadowsocks.go index 8a620464..68c907e2 100644 --- a/adapters/outbound/shadowsocks.go +++ b/adapters/outbound/shadowsocks.go @@ -37,10 +37,6 @@ type ShadowSocksOption struct { UDP bool `proxy:"udp,omitempty"` Plugin string `proxy:"plugin,omitempty"` PluginOpts map[string]interface{} `proxy:"plugin-opts,omitempty"` - - // deprecated when bump to 1.0 - Obfs string `proxy:"obfs,omitempty"` - ObfsHost string `proxy:"obfs-host,omitempty"` } type simpleObfsOption struct { @@ -122,17 +118,6 @@ func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error) { var obfsOption *simpleObfsOption obfsMode := "" - // forward compatibility before 1.0 - if option.Obfs != "" { - obfsMode = option.Obfs - obfsOption = &simpleObfsOption{ - Host: "bing.com", - } - if option.ObfsHost != "" { - obfsOption.Host = option.ObfsHost - } - } - decoder := structure.NewDecoder(structure.Option{TagName: "obfs", WeaklyTypedInput: true}) if option.Plugin == "obfs" { opts := simpleObfsOption{Host: "bing.com"} diff --git a/config/config.go b/config/config.go index b2aea875..a715e40c 100644 --- a/config/config.go +++ b/config/config.go @@ -126,12 +126,6 @@ type RawConfig struct { Proxy []map[string]interface{} `yaml:"proxies"` ProxyGroup []map[string]interface{} `yaml:"proxy-groups"` Rule []string `yaml:"rules"` - - // remove after 1.0 - ProxyProviderOld map[string]map[string]interface{} `yaml:"proxy-provider"` - ProxyOld []map[string]interface{} `yaml:"Proxy"` - ProxyGroupOld []map[string]interface{} `yaml:"Proxy Group"` - RuleOld []string `yaml:"Rule"` } // Parse config @@ -168,11 +162,6 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) { "8.8.8.8", }, }, - - // remove after 1.0 - RuleOld: []string{}, - ProxyOld: []map[string]interface{}{}, - ProxyGroupOld: []map[string]interface{}{}, } if err := yaml.Unmarshal(buf, &rawCfg); err != nil { @@ -264,18 +253,6 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ groupsConfig := cfg.ProxyGroup providersConfig := cfg.ProxyProvider - if len(proxiesConfig) == 0 { - proxiesConfig = cfg.ProxyOld - } - - if len(groupsConfig) == 0 { - groupsConfig = cfg.ProxyGroupOld - } - - if len(providersConfig) == 0 { - providersConfig = cfg.ProxyProviderOld - } - proxies["DIRECT"] = outbound.NewProxy(outbound.NewDirect()) proxies["REJECT"] = outbound.NewProxy(outbound.NewReject()) proxyList = append(proxyList, "DIRECT", "REJECT") @@ -371,14 +348,8 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ func parseRules(cfg *RawConfig, proxies map[string]C.Proxy) ([]C.Rule, error) { rules := []C.Rule{} - rulesConfig := cfg.Rule - // remove after 1.0 - if len(rulesConfig) == 0 { - rulesConfig = cfg.RuleOld - } - // parse rules for idx, line := range rulesConfig { rule := trimArr(strings.Split(line, ",")) diff --git a/hub/executor/executor.go b/hub/executor/executor.go index 2d71bde0..8131ad39 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -4,7 +4,6 @@ import ( "fmt" "io/ioutil" "os" - "path/filepath" "sync" "github.com/Dreamacro/clash/adapters/provider" @@ -25,30 +24,11 @@ var ( mux sync.Mutex ) -// forward compatibility before 1.0 -func readRawConfig(path string) ([]byte, error) { - data, err := ioutil.ReadFile(path) - if err == nil && len(data) != 0 { - return data, nil - } - - if filepath.Ext(path) != ".yaml" { - return nil, err - } - - path = path[:len(path)-5] + ".yml" - if _, fallbackErr := os.Stat(path); fallbackErr == nil { - return ioutil.ReadFile(path) - } - - return data, err -} - func readConfig(path string) ([]byte, error) { if _, err := os.Stat(path); os.IsNotExist(err) { return nil, err } - data, err := readRawConfig(path) + data, err := ioutil.ReadFile(path) if err != nil { return nil, err } @@ -168,9 +148,9 @@ func updateGeneral(general *config.General, force bool) { tunnel.SetMode(general.Mode) resolver.DisableIPv6 = !general.IPv6 - if cfg.Interface != "" { - dialer.DialHook = dialer.DialerWithInterface(cfg.Interface) - dialer.ListenPacketHook = dialer.ListenPacketWithInterface(cfg.Interface) + if general.Interface != "" { + dialer.DialHook = dialer.DialerWithInterface(general.Interface) + dialer.ListenPacketHook = dialer.ListenPacketWithInterface(general.Interface) } else { dialer.DialHook = nil dialer.ListenPacketHook = nil diff --git a/rules/parser.go b/rules/parser.go index 3814056d..2f09e793 100644 --- a/rules/parser.go +++ b/rules/parser.go @@ -25,9 +25,6 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) { case "IP-CIDR", "IP-CIDR6": noResolve := HasNoResolve(params) parsed, parseErr = NewIPCIDR(payload, target, WithIPCIDRNoResolve(noResolve)) - // deprecated when bump to 1.0 - case "SOURCE-IP-CIDR": - fallthrough case "SRC-IP-CIDR": parsed, parseErr = NewIPCIDR(payload, target, WithIPCIDRSourceIP(true), WithIPCIDRNoResolve(true)) case "SRC-PORT": @@ -35,9 +32,6 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) { case "DST-PORT": parsed, parseErr = NewPort(payload, target, false) case "MATCH": - fallthrough - // deprecated when bump to 1.0 - case "FINAL": parsed = NewMatch(target) default: parseErr = fmt.Errorf("unsupported rule type %s", tp)