mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
mv builder to xray
This commit is contained in:
28
core/xray/trojan.go
Normal file
28
core/xray/trojan.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package xray
|
||||
|
||||
import (
|
||||
"github.com/Yuzuki616/V2bX/api/panel"
|
||||
"github.com/Yuzuki616/V2bX/common/format"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/proxy/trojan"
|
||||
)
|
||||
|
||||
func buildTrojanUsers(tag string, userInfo []panel.UserInfo) (users []*protocol.User) {
|
||||
users = make([]*protocol.User, len(userInfo))
|
||||
for i := range userInfo {
|
||||
users[i] = buildTrojanUser(tag, &(userInfo)[i])
|
||||
}
|
||||
return users
|
||||
}
|
||||
|
||||
func buildTrojanUser(tag string, userInfo *panel.UserInfo) (user *protocol.User) {
|
||||
trojanAccount := &trojan.Account{
|
||||
Password: userInfo.Uuid,
|
||||
}
|
||||
return &protocol.User{
|
||||
Level: 0,
|
||||
Email: format.UserTag(tag, userInfo.Uuid),
|
||||
Account: serial.ToTypedMessage(trojanAccount),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user