Skip to main content

Crate ios_core

Crate ios_core 

Source
Expand description

Unified high-level API for iOS device interaction.

This crate ties together device discovery, pairing, tunneling, and service access into a single ergonomic API. It is the recommended entry point for library consumers.

Key types:

Service implementations are feature gated under services. The grouped feature flags are intended for common consumers:

  • classic enables lockdown-era services such as AFC, syslog, screenshots, and profiles.
  • developer enables DTX/Instruments, testmanager, debugserver, WebInspector, and related tools.
  • ios17 enables CoreDevice/RSD services, mDNS discovery, and userspace tunnel support.
  • management enables restore, preboard, companion, arbitration, and device management helpers.
  • full enables the broad CLI surface.

CoreDevice service availability is discovered from the device’s RSD directory at runtime. Do not infer support from ProductVersion alone; newer devices can expose the tunnel and RSD while omitting a specific feature service such as fileservice.

Internal transport modules are not part of the public API. Use top-level re-exports for supported types:

use ios_core::{pair_new_device, PairedCredentials, PairingTransportError};
use ios_core::{default_pair_record_path, LockdownClient, LockdownError, PairRecord};
use ios_core::{archive_string, NsUrl, XcTestConfiguration, XctCapabilities};
use ios_core::{TunMode, TunnelError, TunnelHandle, TunnelInfo, TunnelManager};
use ios_core::proto::nskeyedarchiver_encode::archive_string;
use ios_core::lockdown::PairRecord;
use ios_core::pairing_transport::UNTRUSTED_SERVICE_NAME;
use ios_core::tunnel::TunMode;
use ios_core::xpc::RsdHandshake;

Re-exports§

pub use credentials::PersistedCredentials;
pub use credentials::RemotePairingRecord;
pub use device::discover_paired_mobdev2_devices;
pub use device::connect_direct_usb_tunnel;
pub use device::connect_remote_pairing_tunnel;
pub use device::connect_tcp_lockdown_tunnel;
pub use device::ConnectOptions;
pub use device::ConnectedDevice;
pub use device::InternationalConfiguration;
pub use device::PairedMobdev2Device;
pub use device::ServiceStream;
pub use discovery::browse_mobdev2;
pub use discovery::browse_remotepairing;
pub use discovery::BonjourService;
pub use discovery::MdnsDevice;
pub use discovery::DeviceEvent;
pub use discovery::DeviceInfo;
pub use error::CoreError;
pub use services::accessibility_audit;
pub use services::afc;
pub use services::amfi;
pub use services::apps;
pub use services::arbitration;
pub use services::companion;
pub use services::crashreport;
pub use services::debugserver;
pub use services::deviceinfo;
pub use services::diagnostics;
pub use services::diagnosticsservice;
pub use services::dproxy;
pub use services::dtx;
pub use services::fetchsymbols;
pub use services::file_relay;
pub use services::fileservice;
pub use services::heartbeat;
pub use services::idam;
pub use services::imagemounter;
pub use services::instruments;
pub use services::mcinstall;
pub use services::misagent;
pub use services::mobileactivation;
pub use services::notificationproxy;
pub use services::ostrace;
pub use services::pcap;
pub use services::power_assertion;
pub use services::preboard;
pub use services::prepare;
pub use services::restore;
pub use services::screenshot;
pub use services::springboard;
pub use services::syslog;
pub use services::testmanager;
pub use services::webinspector;
pub use services::backup2;
pub use services::simlocation;

Modules§

credentials
Pairing credential persistence.
device
Device connection orchestration and service access helpers.
discovery
USB and network discovery helpers.
error
Shared high-level error type.
services
Feature-gated iOS device service implementations.
xpc_message_flags
XPC message flags.

Structs§

FullPairRecord
Full pair record data sent inside the lockdown Pair request.
GetValueRequest
GetValueResponse
LockdownClient
High-level Lockdown client. Handles session management and service starting.
MuxClient
usbmuxd client for device discovery and connection.
NsUrl
PairRecord
iOS device pair record, loaded from the platform-specific lockdown directory.
PairedCredentials
Stored credentials after successful pairing.
QueryTypeRequest
QueryTypeResponse
RemoveValueRequest
RsdHandshake
Result of the RSD handshake.
ServiceDescriptor
A discovered iOS 17+ service.
ServiceInfo
Service info returned by StartService.
SetValueRequest
StartServiceRequest
StartServiceResponse
StartSessionRequest
StartSessionResponse
StopSessionRequest
TunnelHandle
A live tunnel handle. Dropping this handle signals the tunnel task to stop.
TunnelInfo
Information returned by the CDTunnel handshake.
TunnelManager
Manager for active tunnel instances.
ValueOperationResponse
XcTestConfiguration
XctCapabilities
XpcClient
High-level XPC client for iOS 17+ services.
XpcMessage
An XPC message.

Enums§

LockdownError
Errors from lockdown operations.
PairRecordError
PairingTransportError
Error type for pairing transport.
TunMode
TUN mode selection.
TunnelError
Errors from tunnel operations.
XpcError
Errors from XPC operations.
XpcValue
XPC value variants (matches go-ios encoding.go type constants).

Constants§

CORE_DEVICE_PROXY
LOCKDOWN_PORT
RSD_PORT

Functions§

archive_array
Encode an array of pre-archived values as NSArray.
archive_bool
Encode a bool as NSKeyedArchiver binary plist (NSNumber/BOOL).
archive_data
Encode a byte array as NSKeyedArchiver binary plist (NSData).
archive_dict
Encode a dictionary as NSDictionary.
archive_float
Encode a float as NSKeyedArchiver binary plist (NSNumber/double).
archive_int
Encode an integer as NSKeyedArchiver binary plist (NSNumber/int64).
archive_nsurl
Encode an NSURL object with a file:// relative path.
archive_null
Encode an NSNull object.
archive_string
Encode a string as NSKeyedArchiver binary plist (NSString).
archive_uuid
Encode an NSUUID object.
archive_xct_capabilities
Encode an XCTCapabilities object with a capabilities-dictionary payload.
archive_xctest_configuration
Encode a minimal XCTestConfiguration object suitable for testmanager startup.
connect
Connect to an iOS device by UDID and optionally establish a CDTunnel.
decode_xpc_message
Decode an XPC message from a byte buffer.
default_pair_record_path
discover_mdns
Discover iOS 17+ devices on the local network via mDNS.
encode_xpc_message
Encode an XPC message to bytes.
handshake_only_service_tls
Perform a TLS handshake and immediately return the underlying plaintext stream.
list_devices
List all currently connected iOS devices (via usbmuxd).
pair_new_device
Perform the full SRP pairing handshake with a new (untrusted) device.
pair_supervised
Perform supervised pairing with a P12 certificate on a raw lockdown stream.
recv_lockdown
save_pair_record
Save a FullPairRecord to disk as a plist file compatible with PairRecord::load().
send_lockdown
start_lockdown_session
Perform lockdown QueryType + StartSession, then upgrade the stream to TLS via native-tls.
start_service
Send StartService over an established TLS session.
strip_service_tls
Drop the post-lockdown service TLS layer and recover the underlying stream.
watch_devices
Watch for usbmux attach/detach events through the reusable ios-core discovery layer.
wrap_service_tls
Wrap a service stream with TLS (for services with EnableServiceSSL=true).