This commit is contained in:
Yuzuki616
2023-08-14 10:21:48 +08:00
parent fac2420105
commit cd55bc9c4b

View File

@@ -2,10 +2,11 @@ package sing
import ( import (
"context" "context"
"github.com/inazumav/sing-box/common/urltest"
"net" "net"
"sync" "sync"
"github.com/inazumav/sing-box/common/urltest"
"github.com/InazumaV/V2bX/common/rate" "github.com/InazumaV/V2bX/common/rate"
"github.com/InazumaV/V2bX/limiter" "github.com/InazumaV/V2bX/limiter"
@@ -71,11 +72,11 @@ func (h *HookServer) RoutedConnection(_ context.Context, conn net.Conn, m adapte
}, },
} }
if c, ok := h.counter.Load(m.Inbound); ok { if c, ok := h.counter.Load(m.Inbound); ok {
return counter.NewConnCounter(conn, c.(*counter.TrafficCounter).GetCounter(m.Inbound)), t return counter.NewConnCounter(conn, c.(*counter.TrafficCounter).GetCounter(m.User)), t
} else { } else {
c := counter.NewTrafficCounter() c := counter.NewTrafficCounter()
h.counter.Store(m.Inbound, c) h.counter.Store(m.Inbound, c)
return counter.NewConnCounter(conn, c.GetCounter(m.Inbound)), t return counter.NewConnCounter(conn, c.GetCounter(m.User)), t
} }
} }