-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel.go
257 lines (246 loc) · 8.13 KB
/
model.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
package cgminer_client
type Map map[string]interface{}
type MapInt64 map[string]int64
/**
"STATUS": [
{
"STATUS": "S",
"When": 1517894216,
"Code": 9,
"Msg": "4 ASC(s)",
"Description": "cgminer 4.10.0"
}
],
*/
type Status struct {
Code int `json:"Code"`
Description string `json:"Description"`
Status string `json:"STATUS"`
When int64 `json:"When"`
}
type DevCommon struct {
Name string `json:"Name,omit"` // omit is special for prometheus_helper library to exclude it
ASC int `json:"ASC"`
ID int `json:"ID"`
}
type Dev struct {
DevCommon
Enabled string `json:"Enabled"`
Status string `json:"Status"`
Temperature float64 `json:"temperature"`
MHSav float64 `json:"MHS av"`
MHS5s float64 `json:"MHS 5s"`
MHS1m float64 `json:"MHS 1m"`
MHS5m float64 `json:"MHS 5m"`
MHS15m float64 `json:"MHS 15m"`
Accepted int64 `json:"Accepted"`
Rejected int64 `json:"Rejected"`
HardwareErrors int64 `json:"Hardware Errors"`
Utility float64 `json:"Utility"`
TotalMH int64 `json:"TotalMH"`
Diff1Work int64 `json:"Diff1 Work"`
DifficultyAccepted float64 `json:"Difficulty Accepted"`
DifficultyRejected float64 `json:"Difficulty Rejected"`
LastShareDifficulty float64 `json:"Last Share Difficulty"`
LastValidWork int64 `json:"Last Valid Work"`
DeviceHardwarePercent float64 `json:"Device Hardware%"`
DeviceRejectedPercent float64 `json:"Device Rejected%"`
DeviceElapsed int64 `json:"Device Elapsed"`
}
type DevsResponse struct {
Status []Status `json:"STATUS"`
Devs []Dev `json:"DEVS"`
Id int64 `json:"id"`
}
/**
"DEVS": [
{
"ASC": 0,
"Name": "ttyS1",
"ID": 1,
"1_accept": 154,
"2_accept": 132,
"3_accept": 138,
"4_accept": 129,
*/
type ChipStat struct {
DevCommon
Accept MapInt64
}
type ChipStatResponse struct {
Status []Status `json:"STATUS"`
Data []Map `json:"DEVS"` // data goes into the map and then gets transformed into ChipStat
Id int64 `json:"id"`
ChipStats []ChipStat
}
//type Pool struct {
// Pool int `json:"POOL"`
// URL string
// Status string
// Priority int64
// Quota int64
// Accepted int64
// Rejected int64
// User string
// LastShareTime int64 `json:"Last Share Time"`
//
// //"POOL": 0,
// //"URL": "stratum+tcp://us2.litecoinpool.org:3333",
// //"Status": "Alive",
// //"Priority": 16842752,
// //"Quota": 1,
// //"Long Poll": "Y",
// //"Getworks": 0,
// //"Accepted": 1273,
// //"Rejected": 76,
// //"Works": 0,
// //"Discarded": 0,
// //"Stale": 0,
// //"Get Failures": 0,
// //"Remote Failures": 0,
// //"User": "hodl4now.10011",
// //"Passwd": "123123",
// //"Last Share Time": 1516693404,
// //"Diff1 Shares": 2048,
// //"Proxy Type": "",
// //"Proxy": "",
// //"Difficulty Accepted": 0.00000000,
// //"Difficulty Rejected": 0.00000000,
// //"Difficulty Stale": 0.00000000,
// //"Last Share Difficulty": 0.00000000,
// //"Has Stratum": true,
// //"Stratum Active": true,
// //"Stratum URL": "stratum+tcp://us2.litecoinpool.org:3333",
// //"Has GBT": false,
// //"Best Share": 0,
// //"Pool Rejected%": 0.0000,
// //"Pool Stale%": 0.0000,
// //"Bad Work": 0
//
//
//
// //Accepted int64
// //BestShare int64 `json:"Best Share"`
// //Diff1Shares int64 `json:"Diff1 Shares"`
// //DifficultyAccepted float64 `json:"Difficulty Accepted"`
// //DifficultyRejected float64 `json:"Difficulty Rejected"`
// //DifficultyStale float64 `json:"Difficulty Stale"`
// //Discarded int64
// //GetFailures int64 `json:"Get Failures"`
// //Getworks int64
// //HasGBT bool `json:"Has GBT"`
// //HasStratum bool `json:"Has Stratum"`
// //LastShareDifficulty float64 `json:"Last Share Difficulty"`
// //LastShareTime int64 `json:"Last Share Time"`
// //LongPoll string `json:"Long Poll"`
// //Pool int64 `json:"POOL"`
// //PoolRejectedPercentage float64 `json:"Pool Rejected%"`
// //PoolStalePercentage float64 `json:"Pool Stale%"`
// //Priority int64
// //ProxyType string `json:"Proxy Type"`
// //Proxy string
// //Quota int64
// //Rejected int64
// //RemoteFailures int64 `json:"Remote Failures"`
// //Stale int64
// //Status string
// //StratumActive bool `json:"Stratum Active"`
// //StratumURL string `json:"Stratum URL"`
// //URL string
// //User string
// //Works int64
//}
type SummaryResponse struct {
Status []Status `json:"STATUS"`
Summary []Summary `json:"SUMMARY"`
Id int64 `json:"id"`
}
//type poolsResponse struct {
// Status []status `json:"STATUS"`
// Pools []Pool `json:"POOLS"`
// Id int64 `json:"id"`
//}
//
//type addPoolResponse struct {
// Status []status `json:"STATUS"`
// Id int64 `json:"id"`
//}
/*
"Elapsed": 48417,
"MHS av": 335.86,
"MHS 5s": 357.15,
"MHS 1m": 323.17,
"MHS 5m": 357.15,
"MHS 15m": 339.55,
"temper1": 31,
"temper2": 31,
"temper3": 31,
"temper4": 31,
"Found Blocks": 0,
"Getworks": 3236,
"Accepted": 8215,
"Rejected": 75,
"Hardware Errors": 1654,
"Utility": 10.18,
"Discarded": 48716,
"Stale": 0,
"Get Failures": 0,
"Local Work": 77113,
"Remote Failures": 0,
"Network Blocks": 366,
"Total MH": 16261155,
"Work Utility": 1.39,
"Difficulty Accepted": 4538.375,
"Difficulty Rejected": 42.875,
"Difficulty Stale": 0,
"Best Share": 8322,
"Device Hardware%": 59.6036,
"Device Rejected%": 3.8247,
"Pool Rejected%": 0.9359,
"Pool Stale%": 0,
"Last getwork": 1517965137
*/
type Summary struct {
Elapsed int64 `json:"Elapsed"`
MHSav float64 `json:"MHS av"`
MHS5s float64 `json:"MHS 5s"`
MHS1m float64 `json:"MHS 1m"`
MHS5m float64 `json:"MHS 5m"`
MHS15m float64 `json:"MHS 15m"`
Temper1 float64 `json:"temper1"`
Temper2 float64 `json:"temper2"`
Temper3 float64 `json:"temper3"`
Temper4 float64 `json:"temper4"`
FoundBlocks int64 `json:"Found Blocks"`
Getworks int64 `json:"Getworks"`
Accepted int64 `json:"Accepted"`
Rejected int64 `json:"Rejected"`
HardwareErrors int64 `json:"Hardware Errors"`
Utility float64 `json:"Utility"`
Discarded int64 `json:"Discarded"`
Stale int64 `json:"Stale"`
GetFailures int64 `json:"Get Failures"`
LocalWork int64 `json:"Local Work"`
RemoteFailures int64 `json:"Remote Failures"`
NetworkBlocks int64 `json:"Network Blocks"`
TotalMH float64 `json:"Total MH"`
WorkUtility float64 `json:"Work Utility"`
DifficultyAccepted float64 `json:"Difficulty Accepted"`
DifficultyRejected float64 `json:"Difficulty Rejected"`
DifficultyStale float64 `json:"Difficulty Stale"`
BestShare int64 `json:"Best Share"`
DeviceHardwarePercent float64 `json:"Device Hardware%"`
DeviceRejectedPercent float64 `json:"Device Rejected%"`
PoolRejectedPercent float64 `json:"Pool Rejected%"`
PoolStalePercent float64 `json:"Pool Stale%"`
LastGetwork int64 `json:"Last getwork"`
InputVolt1 float64 `json:"inputVolt1"`
InputVolt2 float64 `json:"inputVolt2"`
InputVolt3 float64 `json:"inputVolt3"`
OutputVolt1 float64 `json:"outputVolt1"`
OutputVolt2 float64 `json:"outputVolt2"`
OutputVolt3 float64 `json:"outputVolt3"`
InputCurrent1 float64 `json:"inputCurrent1"`
InputCurrent2 float64 `json:"inputCurrent2"`
InputCurrent3 float64 `json:"inputCurrent3"`
}