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), } }