-
Notifications
You must be signed in to change notification settings - Fork 34
/
getnetworkinfo.go
38 lines (34 loc) · 1.2 KB
/
getnetworkinfo.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
package daemonManager
import (
"encoding/json"
"fmt"
)
type GetNetworkInfo struct {
Version int `json:"version"`
Subversion string `json:"subversion"`
Protocolversion int `json:"protocolversion"`
Localservices string `json:"localservices"`
Localrelay bool `json:"localrelay"`
Timeoffset int `json:"timeoffset"`
Networkactive bool `json:"networkactive"`
Connections int `json:"connections"`
Networks []struct {
Name string `json:"name"`
Limited bool `json:"limited"`
Reachable bool `json:"reachable"`
Proxy string `json:"proxy"`
ProxyRandomizeCredentials bool `json:"proxy_randomize_credentials"`
} `json:"networks"`
Relayfee float64 `json:"relayfee"`
Incrementalfee float64 `json:"incrementalfee"`
Localaddresses []interface{} `json:"localaddresses"`
Warnings string `json:"warnings"`
}
func BytesToGetNetworkInfo(b []byte) *GetNetworkInfo {
var getNetworkInfo GetNetworkInfo
err := json.Unmarshal(b, &getNetworkInfo)
if err != nil {
log.Fatal(fmt.Sprint("getDifficulty call failed with error ", err))
}
return &getNetworkInfo
}