mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 20:50:09 +00:00
use route group to storage extra config
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
package hy
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"github.com/Yuzuki616/V2bX/api/panel"
|
||||
"github.com/Yuzuki616/V2bX/conf"
|
||||
"github.com/Yuzuki616/V2bX/limiter"
|
||||
"github.com/sirupsen/logrus"
|
||||
"log"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestServer(t *testing.T) {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
s := NewServer("test")
|
||||
limiter.Init()
|
||||
l := limiter.AddLimiter("test", &conf.LimitConfig{}, nil)
|
||||
s := NewServer("test", l)
|
||||
t.Log(s.runServer(&panel.NodeInfo{
|
||||
Port: 11415,
|
||||
Port: 1145,
|
||||
UpMbps: 100,
|
||||
DownMbps: 100,
|
||||
HyObfs: "atresssdaaaadd",
|
||||
@@ -24,5 +30,13 @@ func TestServer(t *testing.T) {
|
||||
},
|
||||
}))
|
||||
s.users.Store("test1111", struct{}{})
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(10 * time.Second)
|
||||
auth := base64.StdEncoding.EncodeToString([]byte("test1111"))
|
||||
log.Println(auth)
|
||||
log.Println(s.counter.getCounters(auth).UpCounter.Load())
|
||||
}
|
||||
}()
|
||||
select {}
|
||||
}
|
||||
|
||||
@@ -73,11 +73,24 @@ func (c *Core) AddUsers(p *vCore.AddUsersParams) (added int, err error) {
|
||||
users := make([]*protocol.User, 0, len(p.UserInfo))
|
||||
switch p.NodeInfo.Type {
|
||||
case "v2ray":
|
||||
if p.Config.XrayOptions.EnableXtls {
|
||||
users = builder.BuildVlessUsers(p.Tag, p.UserInfo, true)
|
||||
|
||||
if p.Config.XrayOptions.EnableVless ||
|
||||
p.NodeInfo.ExtraConfig.EnableVless {
|
||||
|
||||
if p.Config.XrayOptions.VlessFlow != "" {
|
||||
if p.Config.XrayOptions.VlessFlow == p.NodeInfo.ExtraConfig.VlessFlow {
|
||||
users = builder.BuildVlessUsers(p.Tag, p.UserInfo, p.Config.XrayOptions.VlessFlow)
|
||||
} else {
|
||||
users = builder.BuildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow)
|
||||
}
|
||||
|
||||
} else {
|
||||
users = builder.BuildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow)
|
||||
}
|
||||
} else {
|
||||
users = builder.BuildVmessUsers(p.Tag, p.UserInfo)
|
||||
}
|
||||
|
||||
case "trojan":
|
||||
users = builder.BuildTrojanUsers(p.Tag, p.UserInfo)
|
||||
case "shadowsocks":
|
||||
|
||||
Reference in New Issue
Block a user