Compare commits

..

5 Commits

Author SHA1 Message Date
wyx2685
65f2de55ea fix: 流量用户为null,xray无法断开失效用户连接 2025-09-18 20:39:18 +09:00
wyx2685
4ed6bc6d87 fix mux panic 2025-09-12 16:53:21 +09:00
wyx2685
af7b473c13 update hysteria2 v2.6.3 2025-09-12 14:28:02 +09:00
wyx2685
10f66b57ea test: Add vless encryption 2025-09-12 14:26:58 +09:00
wyx2685
0824bf7a4e update README: go1.25构建指令 2025-08-23 01:10:51 +09:00
10 changed files with 289 additions and 108 deletions

View File

@@ -40,7 +40,6 @@ A V2board node server based on multi core, modified from XrayR.
## TODO
- [ ] 重新实现动态限速
- [ ] 重新实现在线IP同步跨节点在线IP限制
- [ ] 完善使用文档
## 软件安装
@@ -58,7 +57,7 @@ wget -N https://raw.githubusercontent.com/wyx2685/V2bX-script/master/install.sh
## 构建
``` bash
# 通过-tags选项指定要编译的内核 可选 xray sing, hysteria2
go build -v -o ./V2bX -tags "xray sing hysteria2 with_quic with_grpc with_utls with_wireguard with_acme" -trimpath -ldflags "-s -w -buildid="
GOEXPERIMENT=jsonv2 go build -v -o build_assets/V2bX -tags "sing xray hysteria2 with_quic with_grpc with_utls with_wireguard with_acme with_gvisor" -trimpath -ldflags "-X 'github.com/InazumaV/V2bX/cmd.version=$version' -s -w -buildid="
```
## 配置文件及详细使用教程
@@ -72,6 +71,10 @@ go build -v -o ./V2bX -tags "xray sing hysteria2 with_quic with_grpc with_utls w
* 本人不对任何人使用本项目造成的任何后果承担责任。
* 本人比较多变,因此本项目可能会随想法或思路的变动随性更改项目结构或大规模重构代码,若不能接受请勿使用。
## 赞助
[赞助链接](https://v-50.me/)
## Thanks
* [Project X](https://github.com/XTLS/)

View File

@@ -67,6 +67,8 @@ type VAllssNode struct {
Network string `json:"network"`
NetworkSettings json.RawMessage `json:"network_settings"`
NetworkSettingsBack json.RawMessage `json:"networkSettings"`
Encryption string `json:"encryption"`
EncryptionSettings EncSettings `json:"encryption_settings"`
ServerName string `json:"server_name"`
// vless only
@@ -84,6 +86,13 @@ type TlsSettings struct {
Xver uint64 `json:"xver,string"`
}
type EncSettings struct {
Mode string `json:"mode"`
Ticket string `json:"ticket"`
ServerPadding string `json:"server_padding"`
PrivateKey string `json:"private_key"`
}
type RealityConfig struct {
Xver uint64 `json:"Xver"`
MinClientVer string `json:"MinClientVer"`

View File

@@ -0,0 +1,37 @@
package dispatcher
import (
"sync/atomic"
"time"
"github.com/xtls/xray-core/common/buf"
)
var _ buf.TimeoutReader = (*CounterReader)(nil)
type CounterReader struct {
Reader buf.TimeoutReader
Counter *atomic.Int64
}
func (c *CounterReader) ReadMultiBufferTimeout(time.Duration) (buf.MultiBuffer, error) {
mb, err := c.Reader.ReadMultiBufferTimeout(time.Second)
if err != nil {
return nil, err
}
if mb.Len() > 0 {
c.Counter.Add(int64(mb.Len()))
}
return mb, nil
}
func (c *CounterReader) ReadMultiBuffer() (buf.MultiBuffer, error) {
mb, err := c.Reader.ReadMultiBuffer()
if err != nil {
return nil, err
}
if mb.Len() > 0 {
c.Counter.Add(int64(mb.Len()))
}
return mb, nil
}

View File

@@ -37,7 +37,7 @@ var errSniffingTimeout = errors.New("timeout on sniffing")
type cachedReader struct {
sync.Mutex
reader *pipe.Reader
reader buf.TimeoutReader
cache buf.MultiBuffer
}
@@ -95,18 +95,20 @@ func (r *cachedReader) Interrupt() {
r.cache = buf.ReleaseMulti(r.cache)
}
r.Unlock()
r.reader.Interrupt()
if p, ok := r.reader.(*pipe.Reader); ok {
p.Interrupt()
}
}
// DefaultDispatcher is a default implementation of Dispatcher.
type DefaultDispatcher struct {
ohm outbound.Manager
router routing.Router
policy policy.Manager
stats stats.Manager
fdns dns.FakeDNSEngine
Wm *WriterManager
Counter sync.Map
ohm outbound.Manager
router routing.Router
policy policy.Manager
stats stats.Manager
fdns dns.FakeDNSEngine
Counter sync.Map
LinkManagers sync.Map // map[string]*LinkManager
}
func init() {
@@ -130,9 +132,6 @@ func (d *DefaultDispatcher) Init(config *Config, om outbound.Manager, router rou
d.router = router
d.policy = pm
d.stats = sm
d.Wm = &WriterManager{
writers: make(map[string]map[*ManagedWriter]struct{}),
}
return nil
}
@@ -168,7 +167,6 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network) (*
var user *protocol.MemoryUser
if sessionInbound != nil {
user = sessionInbound.User
//sessionInbound.CanSpliceCopy = 3
}
var limit *limiter.Limiter
@@ -196,13 +194,27 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network) (*
common.Interrupt(inboundLink.Reader)
return nil, nil, nil, errors.New("Limited ", user.Email, " by conn or ip")
}
var lm *LinkManager
if lmloaded, ok := d.LinkManagers.Load(user.Email); !ok {
lm = &LinkManager{
writers: make(map[*ManagedWriter]struct{}),
readers: make(map[*ManagedReader]struct{}),
}
d.LinkManagers.Store(user.Email, lm)
} else {
lm = lmloaded.(*LinkManager)
}
managedWriter := &ManagedWriter{
writer: uplinkWriter,
email: user.Email,
manager: d.Wm,
manager: lm,
}
d.Wm.AddWriter(managedWriter)
managedReader := &ManagedReader{
reader: downlinkReader,
manager: lm,
}
lm.AddLink(managedWriter, managedReader)
inboundLink.Writer = managedWriter
outboundLink.Reader = managedReader
if w != nil {
inboundLink.Writer = rate.NewRateLimitWriter(inboundLink.Writer, w)
outboundLink.Writer = rate.NewRateLimitWriter(outboundLink.Writer, w)
@@ -304,7 +316,7 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
} else {
go func() {
cReader := &cachedReader{
reader: outbound.Reader.(*pipe.Reader),
reader: outbound.Reader.(*ManagedReader),
}
outbound.Reader = cReader
result, err := sniffer(ctx, cReader, sniffingRequest.MetadataOnly, destination.Network)
@@ -353,12 +365,84 @@ func (d *DefaultDispatcher) DispatchLink(ctx context.Context, destination net.De
content = new(session.Content)
ctx = session.ContextWithContent(ctx, content)
}
sessionInbound := session.InboundFromContext(ctx)
var user *protocol.MemoryUser
if sessionInbound != nil {
user = sessionInbound.User
}
var limit *limiter.Limiter
var err error
if user != nil && len(user.Email) > 0 {
limit, err = limiter.GetLimiter(sessionInbound.Tag)
if err != nil {
errors.LogInfo(ctx, "get limiter ", sessionInbound.Tag, " error: ", err)
common.Close(outbound.Writer)
common.Interrupt(outbound.Reader)
return errors.New("get limiter ", sessionInbound.Tag, " error: ", err)
}
// Speed Limit and Device Limit
w, reject := limit.CheckLimit(user.Email,
sessionInbound.Source.Address.IP().String(),
destination.Network == net.Network_TCP,
sessionInbound.Source.Network == net.Network_TCP)
if reject {
errors.LogInfo(ctx, "Limited ", user.Email, " by conn or ip")
common.Close(outbound.Writer)
common.Interrupt(outbound.Reader)
return errors.New("Limited ", user.Email, " by conn or ip")
}
var lm *LinkManager
if lmloaded, ok := d.LinkManagers.Load(user.Email); !ok {
lm = &LinkManager{
writers: make(map[*ManagedWriter]struct{}),
readers: make(map[*ManagedReader]struct{}),
}
d.LinkManagers.Store(user.Email, lm)
} else {
lm = lmloaded.(*LinkManager)
}
managedWriter := &ManagedWriter{
writer: outbound.Writer,
manager: lm,
}
managedReader := &ManagedReader{
reader: &buf.TimeoutWrapperReader{Reader: outbound.Reader},
manager: lm,
}
lm.AddLink(managedWriter, managedReader)
outbound.Writer = managedWriter
outbound.Reader = managedReader
if w != nil {
outbound.Writer = rate.NewRateLimitWriter(outbound.Writer, w)
}
var t *counter.TrafficCounter
if c, ok := d.Counter.Load(sessionInbound.Tag); !ok {
t = counter.NewTrafficCounter()
d.Counter.Store(sessionInbound.Tag, t)
} else {
t = c.(*counter.TrafficCounter)
}
ts := t.GetCounter(user.Email)
downcounter := &counter.XrayTrafficCounter{V: &ts.DownCounter}
outbound.Reader = &CounterReader{
Reader: managedReader,
Counter: &ts.UpCounter,
}
outbound.Writer = &dispatcher.SizeStatWriter{
Counter: downcounter,
Writer: outbound.Writer,
}
}
sniffingRequest := content.SniffingRequest
if !sniffingRequest.Enabled {
d.routedDispatch(ctx, outbound, destination, nil, "")
d.routedDispatch(ctx, outbound, destination, limit, "")
} else {
cReader := &cachedReader{
reader: outbound.Reader.(*pipe.Reader),
reader: outbound.Reader.(buf.TimeoutReader),
}
outbound.Reader = cReader
result, err := sniffer(ctx, cReader, sniffingRequest.MetadataOnly, destination.Network)
@@ -383,7 +467,7 @@ func (d *DefaultDispatcher) DispatchLink(ctx context.Context, destination net.De
ob.Target = destination
}
}
d.routedDispatch(ctx, outbound, destination, nil, content.Protocol)
d.routedDispatch(ctx, outbound, destination, limit, content.Protocol)
}
return nil
@@ -518,6 +602,9 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
handler = h
} else {
errors.LogWarning(ctx, "non existing outTag: ", outTag)
common.Close(link.Writer)
common.Interrupt(link.Reader)
return // DO NOT CHANGE: the traffic shouldn't be processed by default outbound if the specified outbound tag doesn't exist (yet), e.g., VLESS Reverse Proxy
}
} else {
errors.LogInfo(ctx, "default route for ", destination)

View File

@@ -2,53 +2,15 @@ package dispatcher
import (
sync "sync"
"time"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
)
type WriterManager struct {
writers map[string]map[*ManagedWriter]struct{}
mu sync.Mutex
}
func (m *WriterManager) AddWriter(writer *ManagedWriter) {
m.mu.Lock()
defer m.mu.Unlock()
if _, exists := m.writers[writer.email]; !exists {
m.writers[writer.email] = make(map[*ManagedWriter]struct{})
}
m.writers[writer.email][writer] = struct{}{}
}
func (m *WriterManager) RemoveWriter(writer *ManagedWriter) {
m.mu.Lock()
defer m.mu.Unlock()
if _, exists := m.writers[writer.email]; !exists {
return
}
delete(m.writers[writer.email], writer)
}
func (m *WriterManager) RemoveWritersForUser(email string) {
m.mu.Lock()
defer m.mu.Unlock()
if _, exists := m.writers[email]; !exists {
return
}
for writer := range m.writers[email] {
delete(m.writers[email], writer)
common.Close(writer.writer)
}
delete(m.writers, email)
}
type ManagedWriter struct {
writer buf.Writer
email string
manager *WriterManager
manager *LinkManager
}
func (w *ManagedWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
@@ -59,3 +21,57 @@ func (w *ManagedWriter) Close() error {
w.manager.RemoveWriter(w)
return common.Close(w.writer)
}
type ManagedReader struct {
reader buf.TimeoutReader
manager *LinkManager
}
func (r *ManagedReader) ReadMultiBuffer() (buf.MultiBuffer, error) {
return r.reader.ReadMultiBuffer()
}
func (r *ManagedReader) ReadMultiBufferTimeout(t time.Duration) (buf.MultiBuffer, error) {
return r.reader.ReadMultiBufferTimeout(t)
}
func (r *ManagedReader) Interrupt() {
r.manager.RemoveReader(r)
common.Interrupt(r.reader)
}
type LinkManager struct {
writers map[*ManagedWriter]struct{}
readers map[*ManagedReader]struct{}
mu sync.Mutex
}
func (m *LinkManager) AddLink(writer *ManagedWriter, reader *ManagedReader) {
m.mu.Lock()
defer m.mu.Unlock()
m.writers[writer] = struct{}{}
m.readers[reader] = struct{}{}
}
func (m *LinkManager) RemoveWriter(writer *ManagedWriter) {
m.mu.Lock()
defer m.mu.Unlock()
delete(m.writers, writer)
}
func (m *LinkManager) RemoveReader(reader *ManagedReader) {
m.mu.Lock()
defer m.mu.Unlock()
delete(m.readers, reader)
}
func (m *LinkManager) CloseAll() {
m.mu.Lock()
defer m.mu.Unlock()
for w := range m.writers {
common.Close(w)
}
for r := range m.readers {
common.Interrupt(r)
}
}

View File

@@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"strings"
"time"
"encoding/json"
@@ -171,8 +172,27 @@ func buildV2ray(config *conf.Options, nodeInfo *panel.NodeInfo, inbound *coreCon
inbound.Settings = (*json.RawMessage)(&s)
} else {
var err error
decryption := "none"
if nodeInfo.VAllss.Encryption != "" {
switch nodeInfo.VAllss.Encryption {
case "mlkem768x25519plus":
encSettings := nodeInfo.VAllss.EncryptionSettings
parts := []string{
"mlkem768x25519plus",
encSettings.Mode,
encSettings.Ticket,
}
if encSettings.ServerPadding != "" {
parts = append(parts, encSettings.ServerPadding)
}
parts = append(parts, encSettings.PrivateKey)
decryption = strings.Join(parts, ".")
default:
return fmt.Errorf("vless decryption method %s is not support", nodeInfo.VAllss.Encryption)
}
}
s, err := json.Marshal(&coreConf.VLessInboundConfig{
Decryption: "none",
Decryption: decryption,
})
if err != nil {
return fmt.Errorf("marshal vless config error: %s", err)

View File

@@ -8,6 +8,7 @@ import (
"github.com/InazumaV/V2bX/common/counter"
"github.com/InazumaV/V2bX/common/format"
vCore "github.com/InazumaV/V2bX/core"
"github.com/InazumaV/V2bX/core/xray/app/dispatcher"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy"
)
@@ -43,8 +44,15 @@ func (c *Xray) DelUsers(users []panel.UserInfo, tag string, _ *panel.NodeInfo) e
return err
}
delete(c.users.uidMap, user)
c.dispatcher.Counter.Delete(user)
c.dispatcher.Wm.RemoveWritersForUser(user)
if v, ok := c.dispatcher.Counter.Load(tag); ok {
tc := v.(*counter.TrafficCounter)
tc.Delete(user)
}
if v, ok := c.dispatcher.LinkManagers.Load(user); ok {
lm := v.(*dispatcher.LinkManager)
lm.CloseAll()
c.dispatcher.LinkManagers.Delete(user)
}
}
return nil
}

29
go.mod
View File

@@ -5,8 +5,8 @@ go 1.25
toolchain go1.25.0
require (
github.com/apernet/hysteria/core/v2 v2.6.2
github.com/apernet/hysteria/extras/v2 v2.6.2
github.com/apernet/hysteria/core/v2 v2.6.3
github.com/apernet/hysteria/extras/v2 v2.6.3
github.com/apernet/quic-go v0.52.1-0.20250607183305-9320c9d14431
github.com/beevik/ntp v1.4.4-0.20240716062501-06ef196b89ec
github.com/fsnotify/fsnotify v1.9.0
@@ -19,11 +19,11 @@ require (
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.19.0
github.com/vmihailenco/msgpack/v5 v5.4.1
github.com/xtls/xray-core v1.250803.1-0.20250821103638-33272a04994e
github.com/xtls/xray-core v1.250911.1-0.20250911134820-83c5370eec69
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.41.0
golang.org/x/sys v0.35.0
google.golang.org/protobuf v1.36.8
golang.org/x/crypto v0.42.0
golang.org/x/sys v0.36.0
google.golang.org/protobuf v1.36.9
)
require (
@@ -80,7 +80,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.34.1 // indirect
github.com/aws/smithy-go v1.22.4 // indirect
github.com/aziontech/azionapi-go-sdk v0.142.0 // indirect
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6 // indirect
github.com/baidubce/bce-sdk-go v0.9.235 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
@@ -264,7 +263,7 @@ require (
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/stretchr/testify v1.11.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e // indirect
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 // indirect
@@ -290,7 +289,7 @@ require (
github.com/vultr/govultr/v3 v3.21.1 // indirect
github.com/wyx2685/sing-vmess v0.0.0-20250723121437-95d5ab59ff92 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xtls/reality v0.0.0-20250725142056-5b52a03d4fb7 // indirect
github.com/xtls/reality v0.0.0-20250904214705-431b6ff8c67c // indirect
github.com/yandex-cloud/go-genproto v0.14.0 // indirect
github.com/yandex-cloud/go-sdk/services/dns v0.0.3 // indirect
github.com/yandex-cloud/go-sdk/v2 v2.0.8 // indirect
@@ -311,11 +310,11 @@ require (
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
golang.org/x/mod v0.27.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.36.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
@@ -324,7 +323,7 @@ require (
google.golang.org/api v0.242.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
google.golang.org/grpc v1.75.0 // indirect
google.golang.org/grpc v1.75.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/ns1/ns1-go.v2 v2.14.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
@@ -334,3 +333,5 @@ require (
)
replace github.com/sagernet/sing-box v1.13.0 => github.com/wyx2685/sing-box_mod v1.13.0-alpha.5
replace github.com/xtls/xray-core v1.250911.1-0.20250911134820-83c5370eec69 => github.com/wyx2685/xray-core v0.0.0-20250912060919-a74bf884128d

54
go.sum
View File

@@ -171,10 +171,10 @@ github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer5
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/anytls/sing-anytls v0.0.9-0.20250508103614-8bc6dd599731 h1:nc7lKMMMXlp6bWFoD5EG10hgNgvYqf7o8icqXfNpNK0=
github.com/anytls/sing-anytls v0.0.9-0.20250508103614-8bc6dd599731/go.mod h1:7rjN6IukwysmdusYsrV51Fgu1uW6vsrdd6ctjnEAln8=
github.com/apernet/hysteria/core/v2 v2.6.2 h1:xqwl8FPr/AWysfYuph1BKE8NpxtKgxq4S/1y2pU/lnQ=
github.com/apernet/hysteria/core/v2 v2.6.2/go.mod h1:cPk2WXzYfovpz+ai+dc0d0965EEXh59ggQkGmFBdHCE=
github.com/apernet/hysteria/extras/v2 v2.6.2 h1:cyOXT6aol5TbXIAjPuj7Ellqx17xoYgHrq7YMo+kzcg=
github.com/apernet/hysteria/extras/v2 v2.6.2/go.mod h1:5eNUW7Em92U87pCFqA89eyly4yw8SlAEz/oih46bSHg=
github.com/apernet/hysteria/core/v2 v2.6.3 h1:+FxrvogBFvBC2ELQYi/bKsObz7vVBS9Cfm1Dl9ntY7k=
github.com/apernet/hysteria/core/v2 v2.6.3/go.mod h1:cPk2WXzYfovpz+ai+dc0d0965EEXh59ggQkGmFBdHCE=
github.com/apernet/hysteria/extras/v2 v2.6.3 h1:FCkAENdjafT7arLzlMmdhzAskUYTSIKvgiG+2eJWZt0=
github.com/apernet/hysteria/extras/v2 v2.6.3/go.mod h1:kaqCijf+fGzmwgifqSZRWxBIRIO38yb2o9FuGDbshpE=
github.com/apernet/quic-go v0.52.1-0.20250607183305-9320c9d14431 h1:9/jM7e+kVALd7Jfu1c27dcEpT/Fd/Gzq2OsQjKjakKI=
github.com/apernet/quic-go v0.52.1-0.20250607183305-9320c9d14431/go.mod h1:I/47OIGG5H/IfAm+nz2c6hm6b/NkEhpvptAoiPcY7jQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
@@ -219,8 +219,6 @@ github.com/aws/smithy-go v1.22.4 h1:uqXzVZNuNexwc/xrh6Tb56u89WDlJY6HS+KC0S4QSjw=
github.com/aws/smithy-go v1.22.4/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
github.com/aziontech/azionapi-go-sdk v0.142.0 h1:1NOHXlC0/7VgbfbTIGVpsYn1THCugM4/SCOXVdUHQ+A=
github.com/aziontech/azionapi-go-sdk v0.142.0/go.mod h1:cA5DY/VP4X5Eu11LpQNzNn83ziKjja7QVMIl4J45feA=
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6 h1:4NNbNM2Iq/k57qEu7WfL67UrbPq1uFWxW4qODCohi+0=
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6/go.mod h1:J29hk+f9lJrblVIfiJOtTFk+OblBawmib4uz/VdKzlg=
github.com/baidubce/bce-sdk-go v0.9.235 h1:iAi+seH9w1Go2szFNzyGumahLGDsuYZ3i8hduX3qiM8=
github.com/baidubce/bce-sdk-go v0.9.235/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg=
github.com/beevik/ntp v1.4.4-0.20240716062501-06ef196b89ec h1:FzxY1QN55kkQrw72IvZiLprQGFXz4ecJj5yIxDkNWhk=
@@ -1071,8 +1069,8 @@ github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
@@ -1134,6 +1132,8 @@ github.com/wyx2685/sing-box_mod v1.13.0-alpha.5 h1:9aG8iDQgqCict6zhMsJU9O6rKQr17
github.com/wyx2685/sing-box_mod v1.13.0-alpha.5/go.mod h1:HJYV1YYy7ucy2R4AotcCCQDxhc1tAMvq8c0VUqcoGZg=
github.com/wyx2685/sing-vmess v0.0.0-20250723121437-95d5ab59ff92 h1:A5/G1mY1M3h+j6D3BgfRlngbsfTUGwE8S3UuyR9VfbU=
github.com/wyx2685/sing-vmess v0.0.0-20250723121437-95d5ab59ff92/go.mod h1:ZvICtYzgNgbRy2fgKTVmG4o+6pP92dzY5GhwSlfya8Q=
github.com/wyx2685/xray-core v0.0.0-20250912060919-a74bf884128d h1:5OM2F962gkzHZe+yk2fM1yeokiAetC884mefA8rgrCI=
github.com/wyx2685/xray-core v0.0.0-20250912060919-a74bf884128d/go.mod h1:pOFdaOfxViLRo2izXjXYn10akJZpbemMWm8yh0jQEgc=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
@@ -1145,10 +1145,8 @@ github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xtls/reality v0.0.0-20250725142056-5b52a03d4fb7 h1:Ript0vN+nSO33+Vj4n0mgNY5M+oOxFQJdrJ1VnwTBO0=
github.com/xtls/reality v0.0.0-20250725142056-5b52a03d4fb7/go.mod h1:XxvnCCgBee4WWE0bc4E+a7wbk8gkJ/rS0vNVNtC5qp0=
github.com/xtls/xray-core v1.250803.1-0.20250821103638-33272a04994e h1:9pk1hdMlClxJoCciiYPhHU0KwFfNazzqfBE5KhZ8/fc=
github.com/xtls/xray-core v1.250803.1-0.20250821103638-33272a04994e/go.mod h1:ge+AMZbONOtGLEWDYZIlmQlHcrEca+/Z51IUhJqnyOo=
github.com/xtls/reality v0.0.0-20250904214705-431b6ff8c67c h1:LHLhQY3mKXSpTcQAkjFR4/6ar3rXjQryNeM7khK3AHU=
github.com/xtls/reality v0.0.0-20250904214705-431b6ff8c67c/go.mod h1:XxvnCCgBee4WWE0bc4E+a7wbk8gkJ/rS0vNVNtC5qp0=
github.com/yandex-cloud/go-genproto v0.14.0 h1:yDqD260mICkjodXyAaDhESfrLr6gIGwwRc9MYE0jvW0=
github.com/yandex-cloud/go-genproto v0.14.0/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo=
github.com/yandex-cloud/go-sdk/services/dns v0.0.3 h1:erphTBXKSpm/tETa6FXrw4niSHjhySzAKHUc2/BZKx0=
@@ -1262,8 +1260,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1370,8 +1368,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1397,8 +1395,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1485,8 +1483,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -1502,8 +1500,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ=
golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1522,8 +1520,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1687,8 +1685,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1703,8 +1701,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@@ -8,7 +8,7 @@ import (
)
func (c *Controller) reportUserTrafficTask() (err error) {
userTraffic, err := c.server.GetUserTrafficSlice(c.tag, true)
userTraffic, _ := c.server.GetUserTrafficSlice(c.tag, true)
if len(userTraffic) > 0 {
err = c.apiClient.ReportUserTraffic(userTraffic)
if err != nil {
@@ -18,6 +18,7 @@ func (c *Controller) reportUserTrafficTask() (err error) {
}).Info("Report user traffic failed")
} else {
log.WithField("tag", c.tag).Infof("Report %d users traffic", len(userTraffic))
log.WithField("tag", c.tag).Debugf("User traffic: %+v", userTraffic)
}
}
@@ -50,6 +51,7 @@ func (c *Controller) reportUserTrafficTask() (err error) {
}).Info("Report online users failed")
} else {
log.WithField("tag", c.tag).Infof("Total %d online users, %d Reported", len(*onlineDevice), len(result))
log.WithField("tag", c.tag).Debugf("Online users: %+v", data)
}
}