mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
29 lines
755 B
Go
29 lines
755 B
Go
package xray
|
|
|
|
import (
|
|
"github.com/InazumaV/V2bX/api/panel"
|
|
"github.com/InazumaV/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),
|
|
}
|
|
}
|