forked from catpie/musdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.go
executable file
·68 lines (55 loc) · 1.12 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package musdk
const (
StatusEnable = 1
StatusDisable = 0
)
type VUser struct {
Email string `json:"email"`
UUID string `json:"uuid"`
AlterID uint32 `json:"alter_id"`
Level uint32 `json:"level"`
}
func (v *VUser) GetEmail() string {
return v.Email
}
func (v *VUser) GetUUID() string {
return v.UUID
}
func (v *VUser) GetAlterID() uint32 {
return v.AlterID
}
func (v *VUser) GetLevel() uint32 {
return v.Level
}
type User struct {
Id int64 `json:"id"`
Port int `json:"port"`
Passwd string `json:"passwd"`
Method string `json:"method"`
Enable int `json:"enable"`
TransferEnable int64 `json:"transfer_enable"`
U int64 `json:"u"`
D int64 `json:"d"`
V2rayUser VUser `json:"v2ray_user"`
}
func (u User) GetPort() int {
return u.Port
}
func (u User) GetId() int64 {
return u.Id
}
func (u User) GetPasswd() string {
return u.Passwd
}
func (u User) GetMethod() string {
return u.Method
}
func (u User) IsEnable() bool {
if u.Enable == 0 {
return false
}
if u.TransferEnable < (u.U + u.D) {
return false
}
return true
}