-
Notifications
You must be signed in to change notification settings - Fork 19
/
shsh.go
53 lines (40 loc) · 1.05 KB
/
shsh.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
package ipsw
import (
"encoding/json"
"io/ioutil"
)
type SHSHJSON map[Identifier]*SHSHDevice
type SHSHDevice struct {
BoardConfig string `json:"board"`
Identifier string `json:"model"`
CPID int `json:"cpid,string"`
BDID int `json:"bdid,string"`
Platform string `json:"platform"`
Firmwares []*SigningStatus `json:"firmwares"`
}
// Firmware is a change to signing window firmware
type SigningStatus struct {
BuildID string `json:"build"`
Version string `json:"version"`
Signing bool `json:"signing"`
Started string `json:"started"`
Stopped string `json:"stopped"`
}
// NewSHSHJSON returns a new instance of SHSHJSON
func NewSHSHJSON(sourceURL string) (SHSHJSON, error) {
resp, err := DefaultClient.Get(sourceURL)
if err != nil {
return nil, err
}
defer resp.Body.Close()
document, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var shsh SHSHJSON
err = json.Unmarshal(document, &shsh)
if err != nil {
return nil, err
}
return shsh, err
}