chore: upgrade and embed the xsync.Map to v4

This commit is contained in:
wwqgtxx
2025-07-15 11:21:21 +08:00
parent 300eb8b12a
commit 349b773b40
18 changed files with 3462 additions and 39 deletions

View File

@@ -14,10 +14,10 @@ import (
"github.com/metacubex/mihomo/common/atomic"
"github.com/metacubex/mihomo/common/queue"
"github.com/metacubex/mihomo/common/utils"
"github.com/metacubex/mihomo/common/xsync"
"github.com/metacubex/mihomo/component/ca"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
"github.com/puzpuzpuz/xsync/v3"
)
var UnifiedDelay = atomic.NewBool(false)
@@ -35,7 +35,7 @@ type Proxy struct {
C.ProxyAdapter
alive atomic.Bool
history *queue.Queue[C.DelayHistory]
extra *xsync.MapOf[string, *internalProxyState]
extra *xsync.Map[string, *internalProxyState]
}
// Adapter implements C.Proxy
@@ -293,7 +293,7 @@ func NewProxy(adapter C.ProxyAdapter) *Proxy {
ProxyAdapter: adapter,
history: queue.New[C.DelayHistory](defaultHistoriesNum),
alive: atomic.NewBool(true),
extra: xsync.NewMapOf[string, *internalProxyState]()}
extra: xsync.NewMap[string, *internalProxyState]()}
}
func urlToMetadata(rawURL string) (addr C.Metadata, err error) {