mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-16 19:32:19 +08:00
Chore: update clash core
This commit is contained in:
parent
1c1e2b9f3d
commit
9e89b3a201
|
@ -1 +1 @@
|
||||||
Subproject commit 043e34f7006d74b68dbb308ca8a43704be3f6712
|
Subproject commit e175b59bc0bb1f01c688f6ac3dc3bf8cf01e1a30
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/dlclark/regexp2"
|
"github.com/dlclark/regexp2"
|
||||||
|
@ -16,6 +17,11 @@ import (
|
||||||
"github.com/Dreamacro/clash/dns"
|
"github.com/Dreamacro/clash/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultHealthCheckUrl = "https://www.gstatic.com/generate_204"
|
||||||
|
defaultHealthCheckInterval = time.Hour
|
||||||
|
)
|
||||||
|
|
||||||
var processors = []processor{
|
var processors = []processor{
|
||||||
patchOverride,
|
patchOverride,
|
||||||
patchGeneral,
|
patchGeneral,
|
||||||
|
@ -88,7 +94,13 @@ func patchProviders(cfg *config.RawConfig, profileDir string) error {
|
||||||
|
|
||||||
func patchProxyGroup(cfg *config.RawConfig, _ string) error {
|
func patchProxyGroup(cfg *config.RawConfig, _ string) error {
|
||||||
for _, g := range cfg.ProxyGroup {
|
for _, g := range cfg.ProxyGroup {
|
||||||
g["lazy"] = false
|
if _, exist := g["url"]; !exist {
|
||||||
|
g["url"] = defaultHealthCheckUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, exist := g["interval"]; !exist {
|
||||||
|
g["interval"] = int(defaultHealthCheckInterval.Seconds())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
adapters "github.com/Dreamacro/clash/adapters/inbound"
|
"github.com/Dreamacro/clash/adapter/inbound"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
)
|
)
|
||||||
|
@ -102,9 +102,9 @@ func (l *httpListener) handleConn(conn net.Conn) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tunnel.Add(adapters.NewHTTPS(request, conn))
|
tunnel.Add(inbound.NewHTTPS(request, conn))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel.Add(adapters.NewHTTP(request, conn))
|
tunnel.Add(inbound.NewHTTP(request, conn))
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/Dreamacro/clash/transport/socks5"
|
||||||
"github.com/kr328/tun2socket"
|
"github.com/kr328/tun2socket"
|
||||||
|
|
||||||
adapters "github.com/Dreamacro/clash/adapters/inbound"
|
"github.com/Dreamacro/clash/adapter/inbound"
|
||||||
"github.com/Dreamacro/clash/common/pool"
|
"github.com/Dreamacro/clash/common/pool"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
|
@ -74,7 +74,7 @@ read:
|
||||||
data: buf[:n],
|
data: buf[:n],
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter := adapters.NewPacket(socks5.ParseAddrToSocksAddr(tAddr), pkt, C.SOCKS)
|
adapter := inbound.NewPacket(socks5.ParseAddrToSocksAddr(tAddr), pkt, C.SOCKS)
|
||||||
|
|
||||||
tunnel.AddPacket(adapter)
|
tunnel.AddPacket(adapter)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package tunnel
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapters/outbound"
|
"github.com/Dreamacro/clash/adapter"
|
||||||
"github.com/Dreamacro/clash/adapters/outboundgroup"
|
"github.com/Dreamacro/clash/adapter/outboundgroup"
|
||||||
"github.com/Dreamacro/clash/adapters/provider"
|
"github.com/Dreamacro/clash/adapter/provider"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@ func HealthCheck(name string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
g, ok := p.(*outbound.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
g, ok := p.(*adapter.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warnln("Request health check for `%s`: invalid type %s", name, p.Type().String())
|
log.Warnln("Request health check for `%s`: invalid type %s", name, p.Type().String())
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapters/provider"
|
"github.com/Dreamacro/clash/adapter/provider"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapters/provider"
|
"github.com/Dreamacro/clash/adapter/provider"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Dreamacro/clash/adapter"
|
||||||
"github.com/dlclark/regexp2"
|
"github.com/dlclark/regexp2"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapters/outbound"
|
"github.com/Dreamacro/clash/adapter/outboundgroup"
|
||||||
"github.com/Dreamacro/clash/adapters/outboundgroup"
|
"github.com/Dreamacro/clash/adapter/provider"
|
||||||
"github.com/Dreamacro/clash/adapters/provider"
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
|
@ -60,7 +60,7 @@ func QueryProxyGroupNames(excludeNotSelectable bool) []string {
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
global := tunnel.Proxies()["GLOBAL"].(*outbound.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
global := tunnel.Proxies()["GLOBAL"].(*adapter.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
||||||
proxies := global.Providers()[0].Proxies()
|
proxies := global.Providers()[0].Proxies()
|
||||||
result := make([]string, 0, len(proxies)+1)
|
result := make([]string, 0, len(proxies)+1)
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ func QueryProxyGroupNames(excludeNotSelectable bool) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range proxies {
|
for _, p := range proxies {
|
||||||
if _, ok := p.(*outbound.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup); ok {
|
if _, ok := p.(*adapter.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup); ok {
|
||||||
if !excludeNotSelectable || p.Type() == C.Selector {
|
if !excludeNotSelectable || p.Type() == C.Selector {
|
||||||
result = append(result, p.Name())
|
result = append(result, p.Name())
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ func QueryProxyGroup(name string, sortMode SortMode, uiSubtitlePattern *regexp2.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
g, ok := p.(*outbound.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
g, ok := p.(*adapter.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warnln("Query group `%s`: invalid type %s", name, p.Type().String())
|
log.Warnln("Query group `%s`: invalid type %s", name, p.Type().String())
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ func PatchSelector(selector, name string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
g, ok := p.(*outbound.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
g, ok := p.(*adapter.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warnln("Patch selector `%s`: invalid type %s", selector, p.Type().String())
|
log.Warnln("Patch selector `%s`: invalid type %s", selector, p.Type().String())
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ func collectProviders(providers []provider.ProxyProvider, uiSubtitlePattern *reg
|
||||||
subtitle := px.Type().String()
|
subtitle := px.Type().String()
|
||||||
|
|
||||||
if uiSubtitlePattern != nil {
|
if uiSubtitlePattern != nil {
|
||||||
if _, ok := px.(*outbound.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup); !ok {
|
if _, ok := px.(*adapter.Proxy).ProxyAdapter.(outboundgroup.ProxyGroup); !ok {
|
||||||
runes := []rune(name)
|
runes := []rune(name)
|
||||||
match, err := uiSubtitlePattern.FindRunesMatch(runes)
|
match, err := uiSubtitlePattern.FindRunesMatch(runes)
|
||||||
if err == nil && match != nil {
|
if err == nil && match != nil {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package tunnel
|
package tunnel
|
||||||
|
|
||||||
import "github.com/Dreamacro/clash/adapters/provider"
|
import "github.com/Dreamacro/clash/adapter/provider"
|
||||||
|
|
||||||
func Suspend(s bool) {
|
func Suspend(s bool) {
|
||||||
provider.Suspend(s)
|
provider.Suspend(s)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user