add singbox core(just started)

This commit is contained in:
Yuzuki616
2023-07-28 09:13:11 +08:00
parent 989a9a1ba0
commit 2812b366b3
28 changed files with 1110 additions and 105 deletions

View File

@@ -9,6 +9,8 @@ import (
"sync/atomic"
"time"
"github.com/Yuzuki616/V2bX/common/counter"
"github.com/Yuzuki616/V2bX/api/panel"
"github.com/Yuzuki616/V2bX/conf"
"github.com/Yuzuki616/V2bX/limiter"
@@ -34,7 +36,7 @@ var serverPacketConnFuncFactoryMap = map[string]pktconns.ServerPacketConnFuncFac
type Server struct {
tag string
l *limiter.Limiter
counter *UserTrafficCounter
counter *counter.TrafficCounter
users sync.Map
running atomic.Bool
*cs.Server
@@ -122,7 +124,7 @@ func (s *Server) runServer(node *panel.NodeInfo, c *conf.ControllerConfig) error
// ACL
var aclEngine *acl.Engine
// Prometheus
s.counter = NewUserTrafficCounter()
s.counter = counter.NewTrafficCounter()
// Packet conn
pktConnFuncFactory := serverPacketConnFuncFactoryMap[""]
if pktConnFuncFactory == nil {