mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
remove no need interface, fix interval type for v2board v1.7.4dev
This commit is contained in:
25
node/user.go
25
node/user.go
@@ -11,9 +11,34 @@ import (
|
||||
"github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
||||
"github.com/xtls/xray-core/proxy/trojan"
|
||||
"github.com/xtls/xray-core/proxy/vless"
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (c *Controller) addNewUser(userInfo []panel.UserInfo, nodeInfo *panel.NodeInfo) (err error) {
|
||||
users := make([]*protocol.User, 0, len(userInfo))
|
||||
switch nodeInfo.NodeType {
|
||||
case "v2ray":
|
||||
if c.EnableVless {
|
||||
users = c.buildVlessUsers(userInfo)
|
||||
} else {
|
||||
users = c.buildVmessUsers(userInfo)
|
||||
}
|
||||
case "Trojan":
|
||||
users = c.buildTrojanUsers(userInfo)
|
||||
case "Shadowsocks":
|
||||
users = c.buildSSUsers(userInfo, getCipherFromString(nodeInfo.Cipher))
|
||||
default:
|
||||
return fmt.Errorf("unsupported node type: %s", nodeInfo.NodeType)
|
||||
}
|
||||
err = c.server.AddUsers(users, c.Tag)
|
||||
if err != nil {
|
||||
return fmt.Errorf("add users error: %s", err)
|
||||
}
|
||||
log.Printf("[%s: %d] Added %d new users", c.nodeInfo.NodeType, c.nodeInfo.NodeId, len(userInfo))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controller) buildVmessUsers(userInfo []panel.UserInfo) (users []*protocol.User) {
|
||||
users = make([]*protocol.User, len(userInfo))
|
||||
for i, user := range userInfo {
|
||||
|
||||
Reference in New Issue
Block a user