-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathstructs.go
161 lines (143 loc) · 3.4 KB
/
structs.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package main
import "time"
// Setting defines the struct for XML configuration file.
type Setting struct {
DSN string
TablePrefix string
Listen string
Debug bool
}
// TrackerResource take configuration into the handler
type TrackerResource struct {
setting Setting
userAgents []AppTorrentAgent
credits map[int]Credit
log bool
}
// Credit store the expressions for credits
type Credit struct {
enabled bool
exp string
}
// Error for BEncode
type Error struct {
reason string `bencode:"failure reason"`
}
// PeerList for BEncode
type PeerList struct {
Interval int `bencode:"interval"`
MinInterval int `bencode:"min interval"`
Complete int `bencode:"complete"`
Incomplete int `bencode:"incomplete"`
Peers []AppTorrentPeer `bencode:"peers"`
}
// AppTorrent table
type AppTorrent struct {
ID int `gorm:"AUTO_INCREMENT;primary_key"`
Tid int
InfoHash string
Size int
Leechers int
Seeders int
Owner int
CreatedAt time.Time
UpdatedAt time.Time
}
// AppTorrentAgent table
type AppTorrentAgent struct {
ID int `gorm:"AUTO_INCREMENT;primary_key"`
Family string
PeerIDPattern string
AgentPattern string
HTTPS bool `gorm:"DEFAULT:0"`
Hits int
}
// AppTorrentHistory table
type AppTorrentHistory struct {
ID int `gorm:"AUTO_INCREMENT;primary_key"`
UID int
TorrentID int
Uploaded int
Downloaded int
Left int
Leeched int
Seeded int
}
// AppTorrentLog table
type AppTorrentLog struct {
ID int `gorm:"AUTO_INCREMENT;primary_key"`
UID int
TorrentID int
Agent string
Passkey string
InfoHash string
PeerID string
IP string
Port int
Uploaded int
Downloaded int
Left int
AnnouncedAt time.Time
}
// AppTorrentPeer table
type AppTorrentPeer struct {
ID int `gorm:"AUTO_INCREMENT;primary_key" bencode:"-"`
UID int `bencode:"-"`
TorrentID int `bencode:"-"`
Username string `bencode:"-"`
IP string `bencode:"ip"`
PeerID string `bencode:"peer id"`
Port int `bencode:"port"`
Uploaded int `bencode:"-"`
Downloaded int `bencode:"-"`
Left int `bencode:"-"`
Seeder bool `gorm:"DEFAULT:0" bencode:"-"`
Connectable bool `gorm:"DEFAULT:0" bencode:"-"`
Agent string `bencode:"-"`
StartedAt time.Time `bencode:"-"`
FinishedAt time.Time `bencode:"-"`
LastAction time.Time `bencode:"-"`
}
// AppTorrentUser table
type AppTorrentUser struct {
UID int `gorm:"primary_key"`
Passkey string
}
// BbsThread table
type BbsThread struct {
Tid int `gorm:"AUTO_INCREMENT;primary_key"`
Disabled int
CreatedUserid int
}
// CommonConfig table
type CommonConfig struct {
Name string
Namespace string
Value string
}
// User table
type User struct {
UID int `gorm:"AUTO_INCREMENT;primary_key"`
Username string
Groupid int
}
// UserBan table
type UserBan struct {
ID int `gorm:"AUTO_INCREMENT;primary_key"`
UID int
Reason string
}
// UserData table
type UserData struct {
UID int `gorm:"AUTO_INCREMENT;primary_key"`
Credit1 float64
Credit2 float64
Credit3 float64
Credit4 float64
Credit5 float64
Credit6 float64
Credit7 float64
Credit8 float64
}
// WindidUserData table
type WindidUserData UserData