Version: v1.0.98 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 27 Imported by: 4




View Source
const DefaultUsbmuxdSocket = "/var/run/usbmuxd"

DefaultUsbmuxdSocket this is the unix domain socket address to connect to.

View Source
const Lockdownport uint16 = 32498

Lockdownport is the port of the always running lockdownd on the iOS device.


This section is empty.


func ByteCountDecimal added in v1.0.84

func ByteCountDecimal(b int64) string

func FixWindowsPaths added in v1.0.40

func FixWindowsPaths(path string) string

FixWindowsPaths replaces backslashes with forward slashes and removes the X: style windows drive letters

func GetAssistiveTouch added in v1.0.78

func GetAssistiveTouch(device DeviceEntry) (bool, error)

func GetProductVersion added in v1.0.30

func GetProductVersion(device DeviceEntry) (*semver.Version, error)

GetProductVersion gets the iOS version of a device

func GetValuesPlist added in v1.0.4

func GetValuesPlist(device DeviceEntry) (map[string]interface{}, error)

GetValuesPlist returns the full lockdown values response as a map, so it can be converted to JSON easily.

func GetWifiMac added in v1.0.48

func GetWifiMac(device DeviceEntry) (string, error)

GetWifiMac gets the static MAC address of the device WiFi. note: this does not report the dynamic MAC if you enable the "automatic WiFi address" feature.

func IOS11 added in v1.0.78

func IOS11() *semver.Version

func IOS12 added in v1.0.38

func IOS12() *semver.Version

func IOS14 added in v1.0.38

func IOS14() *semver.Version

func Listen added in v1.0.85

func Listen() (func() (AttachedMessage, error), func() error, error)

func Ntohs

func Ntohs(port uint16) uint16

Ntohs is a re-implementation of the C function Ntohs. it means networkorder to host oder and basically swaps the endianness of the given int. It returns port converted to little endian.

func Pair added in v1.0.9

func Pair(device DeviceEntry) error

Pair tries to pair with a device. The first time usually fails because the user has to accept a trust pop up on the iOS device. What you have to do to pair is: 1. run the Pair() function 2. accept the trust pop up on the device 3. run the Pair() function a second time

func PairSupervised added in v1.0.25

func PairSupervised(device DeviceEntry, p12bytes []byte, p12Password string) error

PairSupervised uses an organization id from apple configurator so you can pair a supervised device without the need for user interaction (the trust popup) Arguments are the device, the p12 files raw contents and the password used for the p12 file. I basically got this from cfgutil: here is how to turn a p12 into crt and key: openssl pkcs12 -in organization.p12 -out organization.pem -nodes -password pass:a openssl x509 -outform DER -out organization.crt -in organization.pem openssl rsa -outform DER -out organization.key -in organization.pem then you can run: cfgutil -K organization.key -C organization.crt pair

func ParsePlist

func ParsePlist(data []byte) (map[string]interface{}, error)

ParsePlist tries to parse the given bytes, which should be a Plist, into a map[string]interface. It returns the map or an error if the decoding step fails.

func PathExists added in v1.0.24

func PathExists(path string) (bool, error)

PathExists is used to determine whether the path folder exists True if it exists, false otherwise

func SetAssistiveTouch added in v1.0.78

func SetAssistiveTouch(device DeviceEntry, enabled bool) error

EnableAssistiveTouch creates a new lockdown session for the device and enables or disables AssistiveTouch (the on-screen software home button), by using the special key AssistiveTouchEnabledByiTunes. Setting to true will enable AssistiveTouch Setting to false will disable AssistiveTouch, regardless of whether it was previously-enabled through a non-iTunes-related method.

func SetLanguage

func SetLanguage(device DeviceEntry, config LanguageConfiguration) error

SetLanguage creates a new lockdown session for the device and sets a new language and locale. Changes will only be made when the value is not an empty string. To change only the locale, set language to "" and vice versa. If both are empty, nothing is changed. NOTE: Changing a language is an async operation that takes a long time. Springboard will be restarted automatically by the device. If you need to wait for this happen use notificationproxy.WaitUntilSpringboardStarted().

func Sign added in v1.0.57

func Sign(challengeBytes []byte, cert *x509.Certificate, supervisedPrivateKey interface{}) ([]byte, error)

func ToPlist

func ToPlist(data interface{}) string

ToPlist converts a given struct to a Plist using the library. Make sure your struct is exported. It returns a string containing the plist.

func ToPlistBytes

func ToPlistBytes(data interface{}) []byte

ToPlistBytes converts a given struct to a Plist using the library. Make sure your struct is exported. It returns a byte slice containing the plist.


type AllValuesType

type AllValuesType struct {
	ActivationState                             string
	ActivationStateAcknowledged                 bool
	BasebandActivationTicketVersion             string
	BasebandCertID                              int `plist:"BasebandCertId"`
	BasebandChipID                              int
	BasebandKeyHashInformation                  BasebandKeyHashInformationType
	BasebandMasterKeyHash                       string
	BasebandRegionSKU                           []byte
	BasebandSerialNumber                        []byte
	BasebandStatus                              string
	BasebandVersion                             string
	BluetoothAddress                            string
	BoardID                                     int `plist:"BoardId"`
	BrickState                                  bool
	BuildVersion                                string
	CPUArchitecture                             string
	CarrierBundleInfoArray                      []interface{}
	CertID                                      int
	ChipID                                      int
	ChipSerialNo                                []byte
	DeviceClass                                 string
	DeviceColor                                 string
	DeviceName                                  string
	DieID                                       int
	EthernetAddress                             string
	FirmwareVersion                             string
	FusingStatus                                int
	HardwareModel                               string
	HardwarePlatform                            string
	HasSiDP                                     bool
	HostAttached                                bool
	InternationalMobileEquipmentIdentity        string
	MLBSerialNumber                             string
	MobileEquipmentIdentifier                   string
	MobileSubscriberCountryCode                 string
	MobileSubscriberNetworkCode                 string
	ModelNumber                                 string
	NonVolatileRAM                              NonVolatileRAMType
	PartitionType                               string
	PasswordProtected                           bool
	PkHash                                      []byte
	ProductName                                 string
	ProductType                                 string
	ProductVersion                              string
	ProductionSOC                               bool
	ProtocolVersion                             string
	ProximitySensorCalibration                  []byte
	RegionInfo                                  string
	SBLockdownEverRegisteredKey                 bool
	SIMStatus                                   string
	SIMTrayStatus                               string
	SerialNumber                                string
	SoftwareBehavior                            []byte
	SoftwareBundleVersion                       string
	SupportedDeviceFamilies                     []int
	TelephonyCapability                         bool
	TimeIntervalSince1970                       float64
	TimeZone                                    string
	TimeZoneOffsetFromUTC                       float64
	TrustedHostAttached                         bool
	UniqueChipID                                uint64
	UniqueDeviceID                              string
	UseRaptorCerts                              bool
	Uses24HourClock                             bool
	WiFiAddress                                 string
	WirelessBoardSerialNumber                   string
	KCTPostponementInfoPRIVersion               string `plist:"kCTPostponementInfoPRIVersion"`
	KCTPostponementInfoPRLName                  int    `plist:"kCTPostponementInfoPRLName"`
	KCTPostponementInfoServiceProvisioningState bool   `plist:"kCTPostponementInfoServiceProvisioningState"`
	KCTPostponementStatus                       string `plist:"kCTPostponementStatus"`

AllValuesType contains all possible values that can be requested from LockDown

type AttachedMessage

type AttachedMessage struct {
	MessageType string
	DeviceID    int
	Properties  DeviceProperties

AttachedMessage contains some info about when iOS devices are connected or disconnected from the host

func (AttachedMessage) DeviceAttached

func (msg AttachedMessage) DeviceAttached() bool

DeviceAttached checks if the attached message is about a newly added device

func (AttachedMessage) DeviceDetached

func (msg AttachedMessage) DeviceDetached() bool

DeviceDetached checks if the attachedMessage is about a disconnected device

func (AttachedMessage) DeviceEntry added in v1.0.35

func (a AttachedMessage) DeviceEntry() DeviceEntry

type BasebandKeyHashInformationType

type BasebandKeyHashInformationType struct {
	AKeyStatus int
	SKeyHash   []byte
	SKeyStatus int

BasebandKeyHashInformationType containing some baseband related data directly from the ios device

type DeviceConnection

type DeviceConnection struct {
	// contains filtered or unexported fields

DeviceConnection wraps the net.Conn to the ios Device and has support for switching Codecs and enabling SSL

func NewDeviceConnection

func NewDeviceConnection(socketToConnectTo string) (*DeviceConnection, error)

NewDeviceConnection creates a new DeviceConnection pointing to the given socket waiting for a call to Connect()

func NewDeviceConnectionWithConn

func NewDeviceConnectionWithConn(conn net.Conn) *DeviceConnection

NewDeviceConnectionWithConn create a DeviceConnection with a already connected network conn.

func (*DeviceConnection) Close

func (conn *DeviceConnection) Close() error

Close closes the network connection

func (*DeviceConnection) Conn added in v1.0.24

func (conn *DeviceConnection) Conn() net.Conn

func (*DeviceConnection) DisableSessionSSL

func (conn *DeviceConnection) DisableSessionSSL()

DisableSessionSSL is a hack to go back from SSL to an unencrypted conn without closing the connection. It is only used for the debug proxy because certain MAC applications actually disable SSL, use the connection to send unencrypted messages just to then enable SSL again without closing the connection

func (*DeviceConnection) EnableSessionSsl

func (conn *DeviceConnection) EnableSessionSsl(pairRecord PairRecord) error

EnableSessionSsl wraps the underlying net.Conn in a client tls.Conn using the pairRecord.

func (*DeviceConnection) EnableSessionSslHandshakeOnly

func (conn *DeviceConnection) EnableSessionSslHandshakeOnly(pairRecord PairRecord) error

EnableSessionSslHandshakeOnly enables SSL only for the Handshake and then falls back to plaintext DTX based services do that currently

func (*DeviceConnection) EnableSessionSslServerMode

func (conn *DeviceConnection) EnableSessionSslServerMode(pairRecord PairRecord)

EnableSessionSslServerMode wraps the underlying net.Conn in a server tls.Conn using the pairRecord.

func (*DeviceConnection) EnableSessionSslServerModeHandshakeOnly

func (conn *DeviceConnection) EnableSessionSslServerModeHandshakeOnly(pairRecord PairRecord)

EnableSessionSslServerModeHandshakeOnly enables SSL only for the Handshake and then falls back to plaintext DTX based services do that currently. Server mode is needed only in the debugproxy.

func (*DeviceConnection) Reader

func (conn *DeviceConnection) Reader() io.Reader

Reader exposes the underlying net.Conn as io.Reader

func (*DeviceConnection) Send

func (conn *DeviceConnection) Send(bytes []byte) error

Send sends a message

func (*DeviceConnection) Writer

func (conn *DeviceConnection) Writer() io.Writer

Writer exposes the underlying net.Conn as io.Writer

type DeviceConnectionInterface

type DeviceConnectionInterface interface {
	Close() error
	Send(message []byte) error
	Reader() io.Reader
	Writer() io.Writer
	EnableSessionSsl(pairRecord PairRecord) error
	EnableSessionSslServerMode(pairRecord PairRecord)
	EnableSessionSslHandshakeOnly(pairRecord PairRecord) error
	EnableSessionSslServerModeHandshakeOnly(pairRecord PairRecord)
	Conn() net.Conn

DeviceConnectionInterface contains a physical network connection to a usbmuxd socket.

func ConnectToService

func ConnectToService(device DeviceEntry, serviceName string) (DeviceConnectionInterface, error)

ConnectToService connects to a service on the phone and returns the ready to use DeviceConnectionInterface

type DeviceEntry

type DeviceEntry struct {
	DeviceID    int
	MessageType string
	Properties  DeviceProperties

DeviceEntry contains the DeviceID with is sometimes needed f.ex. to enable LockdownSSL. More importantly it contains DeviceProperties where the udid is stored.

func GetDevice

func GetDevice(udid string) (DeviceEntry, error)

GetDevice returns: the device for the udid if a valid udid is provided. if the env variable 'udid' is specified, the device with that udid otherwise it returns the first device in the list.

type DeviceList

type DeviceList struct {
	DeviceList []DeviceEntry

DeviceList is a simple wrapper for a array of DeviceEntry

func DeviceListfromBytes

func DeviceListfromBytes(plistBytes []byte) DeviceList

DeviceListfromBytes parses a DeviceList from a byte array

func ListDevices

func ListDevices() (DeviceList, error)

ListDevices returns a DeviceList containing data about all currently connected iOS devices using a new UsbMuxConnection

func (DeviceList) CreateMapForJSONConverter

func (deviceList DeviceList) CreateMapForJSONConverter() map[string]interface{}

CreateMapForJSONConverter creates a simple json ready map containing all UDIDs

func (DeviceList) String

func (deviceList DeviceList) String() string

String returns a list of all udids in a formatted string

type DeviceProperties

type DeviceProperties struct {
	ConnectionSpeed int
	ConnectionType  string
	DeviceID        int
	LocationID      int
	ProductID       int
	SerialNumber    string

DeviceProperties contains important device related info like the udid which is named SerialNumber here

type FullPairRecordData added in v1.0.9

type FullPairRecordData struct {
	DeviceCertificate []byte
	HostCertificate   []byte
	RootCertificate   []byte
	SystemBUID        string
	HostID            string

type GetAllValuesResponse

type GetAllValuesResponse struct {
	Request string
	Value   AllValuesType

GetAllValuesResponse just the wrapper for AllValuesType

func GetValues

func GetValues(device DeviceEntry) (GetAllValuesResponse, error)

GetValues returns all values of deviceInformation from lockdown

type LanguageConfiguration

type LanguageConfiguration struct {
	Language string
	Locale   string

LanguageConfiguration is a simple struct encapsulating a language and locale string

func GetLanguage

func GetLanguage(device DeviceEntry) (LanguageConfiguration, error)

GetLanguage creates a new lockdown session for the device and retrieves language and locale. It returns a LanguageConfiguration or an error.

type ListenType

type ListenType struct {
	MessageType         string
	ProgName            string
	ClientVersionString string
	ConnType            int
	// contains filtered or unexported fields

ListenType contains infos for creating a LISTEN message for USBMUX

func NewListen

func NewListen() ListenType

NewListen creates a new Listen Message for USBMUX

type LockDownConnection

type LockDownConnection struct {
	// contains filtered or unexported fields

LockDownConnection allows you to interact with the Lockdown service on the phone. You can use this to grab basic info from the device and start other services on the phone.

func ConnectLockdownWithSession

func ConnectLockdownWithSession(device DeviceEntry) (*LockDownConnection, error)

func NewLockDownConnection

func NewLockDownConnection(dev DeviceConnectionInterface) *LockDownConnection

NewLockDownConnection creates a new LockDownConnection with empty sessionId and a PlistCodec.

func (*LockDownConnection) Close

func (lockDownConn *LockDownConnection) Close()

Close closes the underlying DeviceConnection

func (*LockDownConnection) Conn added in v1.0.24

func (lockDownConn *LockDownConnection) Conn() net.Conn

func (LockDownConnection) DisableSessionSSL

func (lockDownConn LockDownConnection) DisableSessionSSL()

DisableSessionSSL see documentation in DeviceConnection

func (LockDownConnection) EnableSessionSsl

func (lockDownConn LockDownConnection) EnableSessionSsl(pairRecord PairRecord) error

EnableSessionSsl see documentation in DeviceConnection

func (LockDownConnection) EnableSessionSslServerMode

func (lockDownConn LockDownConnection) EnableSessionSslServerMode(pairRecord PairRecord)

EnableSessionSslServerMode see documentation in DeviceConnection

func (*LockDownConnection) GetProductVersion

func (lockDownConn *LockDownConnection) GetProductVersion() (string, error)

GetProductVersion returns the ProductVersion of the device f.ex. "10.3"

func (*LockDownConnection) GetValue

func (lockDownConn *LockDownConnection) GetValue(key string) (interface{}, error)

GetValue gets and returns the string value for the lockdown key

func (*LockDownConnection) GetValueForDomain

func (lockDownConn *LockDownConnection) GetValueForDomain(key string, domain string) (interface{}, error)

GetValueForDomain gets and returns the string value for the lockdown key and domain

func (*LockDownConnection) GetValues

func (lockDownConn *LockDownConnection) GetValues() (GetAllValuesResponse, error)

GetValues retrieves a GetAllValuesResponse containing all values lockdown returns

func (*LockDownConnection) ReadMessage

func (lockDownConn *LockDownConnection) ReadMessage() ([]byte, error)

ReadMessage grabs the next LockDown Message using the PlistDecoder from the underlying DeviceConnection and returns the Plist as a byte slice.

func (LockDownConnection) Send

func (lockDownConn LockDownConnection) Send(msg interface{}) error

Send takes a go struct, converts it to a PLIST and sends it with a 4 byte length field.

func (*LockDownConnection) SetValueForDomain

func (lockDownConn *LockDownConnection) SetValueForDomain(key string, domain string, value interface{}) error

SetValueForDomain sets the string value for the lockdown key and domain. If the device returns an error it will be returned as a go error.

func (*LockDownConnection) StartService

func (lockDownConn *LockDownConnection) StartService(serviceName string) (StartServiceResponse, error)

StartService sends a StartServiceRequest using the provided serviceName and returns the Port of the services in a BigEndian Integer. This port cann be used with a new UsbMuxClient and the Connect call.

func (*LockDownConnection) StartSession

func (lockDownConn *LockDownConnection) StartSession(pairRecord PairRecord) (StartSessionResponse, error)

StartSession will send a StartSession Request to Lockdown, wait for the response and enable SSL on the underlying connection if necessary. The devices usually always requests to enable SSL. It returns a StartSessionResponse

func (*LockDownConnection) StopSession

func (lockDownConn *LockDownConnection) StopSession()

StopSession sends a Lockdown StopSessionRequest to the device

type LockDownPairRequest added in v1.0.9

type LockDownPairRequest struct {
	Label           string
	PairRecord      FullPairRecordData
	Request         string
	ProtocolVersion string
	PairingOptions  PairingOptions

type LockdownPairResponse added in v1.0.9

type LockdownPairResponse struct {
	Error     string
	Request   string
	EscrowBag []byte

type MuxResponse

type MuxResponse struct {
	MessageType string
	Number      uint32

MuxResponse is a generic response message sent by usbmuxd it contains a Number response code

func MuxResponsefromBytes

func MuxResponsefromBytes(plistBytes []byte) MuxResponse

MuxResponsefromBytes parses a MuxResponse struct from bytes

func (MuxResponse) IsSuccessFull

func (u MuxResponse) IsSuccessFull() bool

IsSuccessFull returns UsbMuxResponse.Number==0

type NonVolatileRAMType

type NonVolatileRAMType struct {
	AutoBoot              []byte `plist:"auto-boot"`
	BacklightLevel        []byte `plist:"backlight-level"`
	BootArgs              string `plist:"boot-args"`
	Bootdelay             []byte `plist:"bootdelay"`
	ComAppleSystemTz0Size []byte `plist:""`
	OblitBegins           []byte `plist:"oblit-begins"`
	Obliteration          []byte `plist:"obliteration"`

NonVolatileRAMType contains some internal device info and can be retrieved by getting all values

type PairRecord

type PairRecord struct {
	HostID            string
	SystemBUID        string
	HostCertificate   []byte
	HostPrivateKey    []byte
	DeviceCertificate []byte
	EscrowBag         []byte
	WiFiMACAddress    string
	RootCertificate   []byte
	RootPrivateKey    []byte

PairRecord contains the HostID string, the SystemBUID string, the HostCertificate []byte and the HostPrivateKey []byte. It is needed for enabling SSL Connections over Lockdown

func PairRecordfromBytes

func PairRecordfromBytes(plistBytes []byte) PairRecord

PairRecordfromBytes parsed a plist into a PairRecord

func ReadPairRecord

func ReadPairRecord(udid string) (PairRecord, error)

ReadPairRecord creates a new USBMuxConnection just to read the pair record and closes it right after than.

type PairRecordData

type PairRecordData struct {
	PairRecordData []byte

PairRecordData only holds a []byte containing the PairRecord data as a serialized Plist.

type PairingOptions added in v1.0.9

type PairingOptions struct {
	ExtendedPairingErrors bool

type PlistCodec

type PlistCodec struct {

PlistCodec is a codec for PLIST based services with [4 byte big endian length][plist-payload] based messages

func NewPlistCodec

func NewPlistCodec() PlistCodec

NewPlistCodec create a codec for PLIST based services with [4 byte big endian length][plist-payload] based messages

func (PlistCodec) Decode

func (plistCodec PlistCodec) Decode(r io.Reader) ([]byte, error)

Decode reads a Lockdown Message from the provided reader and sends it to the ResponseChannel

func (PlistCodec) Encode

func (plistCodec PlistCodec) Encode(message interface{}) ([]byte, error)

Encode encodes a LockDown Struct to a byte[] with the lockdown plist format. It returns a byte array that contains a 4 byte length unsigned big endian integer followed by the plist as a string

type ReadDevicesType

type ReadDevicesType struct {
	MessageType         string
	ProgName            string
	ClientVersionString string

ReadDevicesType contains all the data necessary to request a DeviceList from usbmuxd. Can be created with newReadDevices

func NewReadDevices

func NewReadDevices() ReadDevicesType

NewReadDevices creates a struct containing a request for a device list that can be sent to UsbMuxD.

type ReadPair

type ReadPair struct {
	BundleID            string
	ClientVersionString string
	MessageType         string
	ProgName            string
	LibUSBMuxVersion    uint32 `plist:"kLibUSBMuxVersion"`
	PairRecordID        string

ReadPair contains all the Infos necessary to request a PairRecord from usbmuxd. use newReadPair(udid string) to create one.

type SavePair added in v1.0.9

type SavePair struct {
	BundleID            string
	ClientVersionString string
	MessageType         string
	ProgName            string
	LibUSBMuxVersion    uint32 `plist:"kLibUSBMuxVersion"`
	PairRecordID        string
	PairRecordData      []byte

type StartServiceResponse

type StartServiceResponse struct {
	Port             uint16
	Request          string
	Service          string
	EnableServiceSSL bool
	Error            string

StartServiceResponse is sent by the phone after starting a service, it contains servicename, port and tells us whether we should enable SSL or not.

func StartService

func StartService(device DeviceEntry, serviceName string) (StartServiceResponse, error)

StartService conveniently starts a service on a device and cleans up the used UsbMuxconnection. It returns the service port as a uint16 in BigEndian byte order.

type StartSessionResponse

type StartSessionResponse struct {
	EnableSessionSSL bool
	Request          string
	SessionID        string

StartSessionResponse contains the information sent by the device as a response to a StartSessionRequest.

type UsbMuxConnection

type UsbMuxConnection struct {
	// contains filtered or unexported fields

UsbMuxConnection can send and read messages to the usbmuxd process to manage pairrecors, listen for device changes and connect to services on the phone. Usually messages follow a request-response pattern. there is a tag integer in the message header, that is increased with every sent message.

func NewUsbMuxConnection

func NewUsbMuxConnection(deviceConn DeviceConnectionInterface) *UsbMuxConnection

NewUsbMuxConnection creates a new UsbMuxConnection from an already initialized DeviceConnectionInterface

func NewUsbMuxConnectionSimple added in v1.0.8

func NewUsbMuxConnectionSimple() (*UsbMuxConnection, error)

NewUsbMuxConnectionSimple creates a new UsbMuxConnection with a connection to /var/run/usbmuxd

func (*UsbMuxConnection) Close added in v1.0.9

func (muxConn *UsbMuxConnection) Close() error

Close calls close on the underlying DeviceConnection

func (*UsbMuxConnection) Connect

func (muxConn *UsbMuxConnection) Connect(deviceID int, port uint16) error

Connect issues a Connect Message to UsbMuxd for the given deviceID on the given port enabling the newCodec for it. It returns an error containing the UsbMux error code should the connect fail.

func (*UsbMuxConnection) ConnectLockdown

func (muxConn *UsbMuxConnection) ConnectLockdown(deviceID int) (*LockDownConnection, error)

ConnectLockdown connects this Usbmux connection to the LockDown service that always runs on the device on the same port. The connect call needs the deviceID which can be retrieved from a DeviceList using the ListDevices function. After this function is done, the UsbMuxConnection cannot be used anymore because the same underlying network connection is used for talking to Lockdown. Sending usbmux commands would break it. It returns a new LockDownConnection.

func (*UsbMuxConnection) ListDevices

func (muxConn *UsbMuxConnection) ListDevices() (DeviceList, error)

ListDevices returns a DeviceList containing data about all currently connected iOS devices

func (*UsbMuxConnection) Listen

func (muxConn *UsbMuxConnection) Listen() (func() (AttachedMessage, error), error)

Listen will send a listen command to usbmuxd which will cause this connection to stay open indefinitely and receive messages whenever devices are connected or disconnected

func (*UsbMuxConnection) ReadBuid added in v1.0.9

func (muxConn *UsbMuxConnection) ReadBuid() (string, error)

ReadBuid requests the BUID of the host It returns the deserialized BUID as a string.

func (*UsbMuxConnection) ReadMessage

func (muxConn *UsbMuxConnection) ReadMessage() (UsbMuxMessage, error)

ReadMessage blocks until the next muxMessage is available on the underlying DeviceConnection and returns it.

func (*UsbMuxConnection) ReadPair

func (muxConn *UsbMuxConnection) ReadPair(udid string) (PairRecord, error)

ReadPair reads the PairRecord from the usbmux socket for the given udid. It returns the deserialized PairRecord.

func (*UsbMuxConnection) ReleaseDeviceConnection

func (muxConn *UsbMuxConnection) ReleaseDeviceConnection() DeviceConnectionInterface

ReleaseDeviceConnection dereferences this UsbMuxConnection from the underlying DeviceConnection and it returns the DeviceConnection for later use. This UsbMuxConnection cannot be used after calling this.

func (*UsbMuxConnection) Send

func (muxConn *UsbMuxConnection) Send(msg interface{}) error

Send sends and encodes a Plist using the usbmux Encoder. Increases the connection tag by one.

func (*UsbMuxConnection) SendMuxMessage

func (muxConn *UsbMuxConnection) SendMuxMessage(msg UsbMuxMessage) error

SendMuxMessage serializes and sends a UsbMuxMessage to the underlying DeviceConnection. This does not increase the tag on the connection. Is used mainly by the debug proxy to forward messages between device and host

type UsbMuxHeader

type UsbMuxHeader struct {
	Length  uint32
	Version uint32
	Request uint32
	Tag     uint32

UsbMuxHeader contains the header for plist messages for the usbmux daemon.

type UsbMuxMessage

type UsbMuxMessage struct {
	Header  UsbMuxHeader
	Payload []byte

UsbMuxMessage contains header and payload for a message to usbmux

type ValueResponse

type ValueResponse struct {
	Key     string
	Request string
	Error   string
	Domain  string
	Value   interface{}

ValueResponse contains the response for a GetValue or SetValue Request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL