-
Notifications
You must be signed in to change notification settings - Fork 69
/
housearrest.go
57 lines (45 loc) · 1.23 KB
/
housearrest.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
package giDevice
import "github.com/electricbubble/gidevice/pkg/libimobiledevice"
var _ HouseArrest = (*houseArrest)(nil)
func newHouseArrest(client *libimobiledevice.HouseArrestClient) *houseArrest {
return &houseArrest{
client: client,
}
}
type houseArrest struct {
client *libimobiledevice.HouseArrestClient
}
func (h *houseArrest) Documents(bundleID string) (afc Afc, err error) {
var pkt libimobiledevice.Packet
if pkt, err = h.client.NewXmlPacket(
h.client.NewDocumentsRequest(bundleID),
); err != nil {
return nil, err
}
if err = h.client.SendPacket(pkt); err != nil {
return nil, err
}
if _, err = h.client.ReceivePacket(); err != nil {
return nil, err
}
afcClient := libimobiledevice.NewAfcClient(h.client.InnerConn())
afc = newAfc(afcClient)
return
}
func (h *houseArrest) Container(bundleID string) (afc Afc, err error) {
var pkt libimobiledevice.Packet
if pkt, err = h.client.NewXmlPacket(
h.client.NewContainerRequest(bundleID),
); err != nil {
return nil, err
}
if err = h.client.SendPacket(pkt); err != nil {
return nil, err
}
if _, err = h.client.ReceivePacket(); err != nil {
return nil, err
}
afcClient := libimobiledevice.NewAfcClient(h.client.InnerConn())
afc = newAfc(afcClient)
return
}