public async Task Usbmuxd_CanListDevices_Async() { var config = KubernetesClientConfiguration.BuildDefaultConfig(); if (config.Namespace == null) { config.Namespace = "default"; } using (var kubernetes = new KubernetesProtocol( config, this.loggerFactory.CreateLogger <KubernetesProtocol>(), this.loggerFactory)) using (var client = new KubernetesClient( kubernetes, KubernetesOptions.Default, this.output.BuildLoggerFor <KubernetesClient>(), this.loggerFactory)) { // There's at least one usbmuxd pod var pods = await kubernetes.ListNamespacedPodAsync(config.Namespace, labelSelector : "app.kubernetes.io/component=usbmuxd"); Assert.NotEmpty(pods.Items); var pod = pods.Items[0]; // The pod is in the running state pod = await client.WaitForPodRunningAsync(pod, TimeSpan.FromMinutes(2), default).ConfigureAwait(false); Assert.Equal("Running", pod.Status.Phase); // We can connect to port 27015 and retrieve an empty device list var locator = new KubernetesMuxerSocketLocator(kubernetes, pod, this.loggerFactory.CreateLogger <KubernetesMuxerSocketLocator>(), this.loggerFactory); var muxerClient = new MuxerClient(locator, this.loggerFactory.CreateLogger <MuxerClient>(), this.loggerFactory); var devices = await muxerClient.ListDevicesAsync(default).ConfigureAwait(false);
/// <summary> /// Initializes a new instance of the <see cref="PairingRecordProvisioner"/> class. /// </summary> /// <param name="muxerClient"> /// A <see cref="MuxerClient"/> which represents the connection to the muxer. /// </param> /// <param name="kubernetesPairingRecordStore"> /// A <see cref="PairingRecordStore"/> which provides access to the pairing records stored in the cluster. /// </param> /// <param name="serviceProvider"> /// A <see cref="ServiceProvider"/> which can be used to acquire services. /// </param> /// <param name="logger"> /// A logger which can be used when logging. /// </param> public PairingRecordProvisioner(MuxerClient muxerClient, KubernetesPairingRecordStore kubernetesPairingRecordStore, DeviceServiceProvider serviceProvider, ILogger <PairingRecordProvisioner> logger) { this.muxerClient = muxerClient ?? throw new ArgumentNullException(nameof(muxerClient)); this.kubernetesPairingRecordStore = kubernetesPairingRecordStore ?? throw new ArgumentNullException(nameof(kubernetesPairingRecordStore)); this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Initializes a new instance of the <see cref="UsbmuxdSidecar"/> class. /// </summary> /// <param name="muxerClient"> /// A <see cref="MuxerClient"/> which represents a connection to the local iOS USB muxer. /// </param> /// <param name="kubernetes"> /// A <see cref="KubernetesClient"/> which represents a connection to the Kubernetes cluster. /// </param> /// <param name="pairingRecordProvisioner"> /// A <see cref="PairingRecordProvisioner"/> which can be used to retrieve or generate a pairing record. /// </param> /// <param name="developerDiskProvisioner"> /// A <see cref="DeveloperDiskProvisioner"/> which can be used to mount developer disk images on the device. /// </param> /// <param name="configuration"> /// A <see cref="UsbmuxdSidecarConfiguration"/> which represents the configuration for this sidecar. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used to log messages. /// </param> public UsbmuxdSidecar(MuxerClient muxerClient, KubernetesClient kubernetes, PairingRecordProvisioner pairingRecordProvisioner, DeveloperDiskProvisioner developerDiskProvisioner, UsbmuxdSidecarConfiguration configuration, ILogger <UsbmuxdSidecar> logger) { this.muxerClient = muxerClient ?? throw new ArgumentNullException(nameof(muxerClient)); this.kubernetesClient = kubernetes ?? throw new ArgumentNullException(nameof(kubernetes)); this.pairingRecordProvisioner = pairingRecordProvisioner ?? throw new ArgumentNullException(nameof(pairingRecordProvisioner)); this.developerDiskProvisioner = developerDiskProvisioner ?? throw new ArgumentNullException(nameof(developerDiskProvisioner)); this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.deviceClient = this.kubernetesClient.GetClient <MobileDevice>(); }
/// <summary> /// Initializes a new instance of the <see cref="PairingWorker"/> class. /// </summary> /// <param name="muxerClient"> /// A <see cref="MuxerClient"/> which can be used to interact with the muxer. /// </param> /// <param name="context"> /// The device context. /// </param> /// <param name="lockdownClientFactory"> /// A <see cref="LockdownClientFactory"/> which can be used to construct a lockdown client. /// </param> /// <param name="notificationProxyClientFactory"> /// A <see cref="NotificationProxyClientFactory"/> which can be used to construct a notification proxy client. /// </param> /// <param name="pairingRecordGenerator"> /// A <see cref="pairingRecordGenerator"/> which can be used to generate a pairing record. /// </param> public PairingWorker( MuxerClient muxerClient, DeviceContext context, ClientFactory <LockdownClient> lockdownClientFactory, ClientFactory <NotificationProxyClient> notificationProxyClientFactory, PairingRecordGenerator pairingRecordGenerator) { this.muxer = muxerClient ?? throw new ArgumentNullException(nameof(muxerClient)); this.context = context ?? throw new ArgumentNullException(nameof(context)); this.notificationProxyClientFactory = notificationProxyClientFactory ?? throw new ArgumentNullException(nameof(notificationProxyClientFactory)); this.lockdownClientFactory = lockdownClientFactory ?? throw new ArgumentNullException(nameof(lockdownClientFactory)); this.pairingRecordGenerator = pairingRecordGenerator ?? throw new ArgumentNullException(nameof(pairingRecordGenerator)); }
/// <summary> /// Initializes a new instance of the <see cref="DiagnosticsRelayClientFactory"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="propertyListProtocolFactory"> /// A <see cref="PropertyListProtocolFactory"/> which can be used to create new instances of the <see cref="PropertyListProtocol"/> class. /// </param> /// <param name="lockdownClientFactory"> /// A <see cref="LockdownClientFactory"/> which can create a connection to lockdown. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public DiagnosticsRelayClientFactory(MuxerClient muxer, DeviceContext context, PropertyListProtocolFactory propertyListProtocolFactory, ClientFactory <LockdownClient> lockdownClientFactory, ILogger <DiagnosticsRelayClient> logger) : base(muxer, context, propertyListProtocolFactory, lockdownClientFactory, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="NotificationProxyClientFactory"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="propertyListProtocolFactory"> /// A <see cref="PropertyListProtocolFactory"/> which can be used to create new instances of the <see cref="PropertyListProtocol"/> class. /// </param> /// <param name="lockdownClientFactory"> /// A <see cref="LockdownClientFactory"/> which can create a connection to lockdown. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public NotificationProxyClientFactory(MuxerClient muxer, DeviceContext context, PropertyListProtocolFactory propertyListProtocolFactory, ClientFactory <LockdownClient> lockdownClientFactory, ILogger <NotificationProxyClient> logger) : base(muxer, context, propertyListProtocolFactory, lockdownClientFactory, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="SpringBoardClientFactory"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="propertyListProtocolFactory"> /// A <see cref="PropertyListProtocolFactory"/> which can be used to create new instances of the <see cref="PropertyListProtocol"/> class. /// </param> /// <param name="lockdownClientFactory"> /// A <see cref="LockdownClientFactory"/> which can create a connection to lockdown. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public SpringBoardClientFactory(MuxerClient muxer, DeviceContext context, PropertyListProtocolFactory propertyListProtocolFactory, LockdownClientFactory lockdownClientFactory, ILogger <SpringBoardClient> logger) : base(muxer, context, propertyListProtocolFactory, lockdownClientFactory, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="LockdownClientFactory"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public LockdownClientFactory(MuxerClient muxer, DeviceContext context, ILogger <LockdownClient> logger) : base(muxer, context, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="ServiceClientFactory{T}"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="propertyListProtocolFactory"> /// A <see cref="PropertyListProtocolFactory"/> which can be used to create new instances of the <see cref="PropertyListProtocol"/> class. /// </param> /// <param name="lockdownClientFactory"> /// A <see cref="LockdownClientFactory"/> which can be used to create new lockdown clients. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public ServiceClientFactory(MuxerClient muxer, DeviceContext context, PropertyListProtocolFactory propertyListProtocolFactory, ClientFactory <LockdownClient> lockdownClientFactory, ILogger <T> logger) : base(muxer, context, logger) { this.factory = lockdownClientFactory ?? throw new ArgumentNullException(nameof(lockdownClientFactory)); this.propertyListProtocolFactory = propertyListProtocolFactory ?? throw new ArgumentNullException(nameof(propertyListProtocolFactory)); }
/// <summary> /// Initializes a new instance of the <see cref="MobileImageMounterClientFactory"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="propertyListProtocolFactory"> /// A <see cref="PropertyListProtocolFactory"/> which can be used to create new instances of the <see cref="PropertyListProtocol"/> class. /// </param> /// <param name="lockdownClientFactory"> /// A <see cref="LockdownClientFactory"/> which can create a connection to lockdown. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public MobileImageMounterClientFactory(MuxerClient muxer, DeviceContext context, PropertyListProtocolFactory propertyListProtocolFactory, ClientFactory <LockdownClient> lockdownClientFactory, ILogger <MobileImageMounterClient> logger) : base(muxer, context, propertyListProtocolFactory, lockdownClientFactory, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="ClientFactory{T}"/> class. /// </summary> /// <param name="muxer"> /// The <see cref="MuxerClient"/> which represents the connection to the iOS USB Multiplexor. /// </param> /// <param name="context"> /// The <see cref="DeviceContext"/> which contains information about the device with which /// we are interacting. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> which can be used when logging. /// </param> public ClientFactory(MuxerClient muxer, DeviceContext context, ILogger <T> logger) { this.Muxer = muxer ?? throw new ArgumentNullException(nameof(muxer)); this.Context = context ?? throw new ArgumentNullException(nameof(context)); this.Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }