Cargo fmt check during CI

This commit is contained in:
Jackson Coxson
2025-08-13 08:06:58 -06:00
parent 876e88d6fb
commit 4fca58a2f3
29 changed files with 46 additions and 57 deletions

View File

@@ -4,19 +4,19 @@
use std::str::FromStr;
use rsa::{
RsaPrivateKey, RsaPublicKey,
pkcs1::DecodeRsaPublicKey,
pkcs1v15::SigningKey,
pkcs8::{EncodePrivateKey, LineEnding, SubjectPublicKeyInfo},
RsaPrivateKey, RsaPublicKey,
};
use sha2::Sha256;
use x509_cert::{
Certificate,
builder::{Builder, CertificateBuilder, Profile},
der::EncodePem,
name::Name,
serial_number::SerialNumber,
time::Validity,
Certificate,
};
#[derive(Clone, Debug)]

View File

@@ -7,7 +7,7 @@ use std::path::Path;
use log::warn;
use plist::Data;
use rustls::pki_types::{pem::PemObject, CertificateDer};
use rustls::pki_types::{CertificateDer, pem::PemObject};
use serde::{Deserialize, Serialize};
/// Represents a complete iOS device pairing record

View File

@@ -8,7 +8,7 @@ use std::{future::Future, pin::Pin};
#[cfg(feature = "tcp")]
use tokio::net::TcpStream;
use crate::{pairing_file::PairingFile, Idevice, IdeviceError, ReadWrite};
use crate::{Idevice, IdeviceError, ReadWrite, pairing_file::PairingFile};
#[cfg(feature = "usbmuxd")]
use crate::usbmuxd::UsbmuxdAddr;

View File

@@ -2,7 +2,7 @@
use plist::Dictionary;
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
/// Client for interacting with the AMFI service on the device
pub struct AmfiClient {

View File

@@ -13,7 +13,7 @@
//! # Features
//! - `tunnel_tcp_stack`: Enables software TCP/IP tunnel creation using a virtual adapter. See the tcp moduel.
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
use byteorder::{BigEndian, WriteBytesExt};
use serde::{Deserialize, Serialize};

View File

@@ -9,7 +9,7 @@
use log::{debug, warn};
use crate::{afc::AfcClient, lockdown::LockdownClient, obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, afc::AfcClient, lockdown::LockdownClient, obf};
/// Client for managing crash logs on an iOS device.
///

View File

@@ -8,7 +8,7 @@ use log::debug;
use std::fmt::Write;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use crate::{obf, IdeviceError, ReadWrite, RsdService};
use crate::{IdeviceError, ReadWrite, RsdService, obf};
impl RsdService for DebugProxyClient<Box<dyn ReadWrite>> {
fn rsd_service_name() -> std::borrow::Cow<'static, str> {

View File

@@ -1,6 +1,6 @@
//! Diagnostics Relay
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
/// Client for interacting with the Diagnostics Relay
pub struct DiagnosticsRelayClient {
@@ -75,7 +75,6 @@ impl DiagnosticsRelayClient {
.and_then(|mut x| x.remove("IORegistry"))
.and_then(|x| x.into_dictionary());
Ok(res)
}
@@ -110,9 +109,7 @@ impl DiagnosticsRelayClient {
}
}
let res = res
.remove("Diagnostics")
.and_then(|x| x.into_dictionary());
let res = res.remove("Diagnostics").and_then(|x| x.into_dictionary());
Ok(res)
}
@@ -137,9 +134,7 @@ impl DiagnosticsRelayClient {
}
}
let res = res
.remove("Diagnostics")
.and_then(|x| x.into_dictionary());
let res = res.remove("Diagnostics").and_then(|x| x.into_dictionary());
Ok(res)
}
@@ -164,9 +159,7 @@ impl DiagnosticsRelayClient {
}
}
let res = res
.remove("Diagnostics")
.and_then(|x| x.into_dictionary());
let res = res.remove("Diagnostics").and_then(|x| x.into_dictionary());
Ok(res)
}
@@ -191,9 +184,7 @@ impl DiagnosticsRelayClient {
}
}
let res = res
.remove("Diagnostics")
.and_then(|x| x.into_dictionary());
let res = res.remove("Diagnostics").and_then(|x| x.into_dictionary());
Ok(res)
}
@@ -272,9 +263,7 @@ impl DiagnosticsRelayClient {
}
}
let res = res
.remove("Diagnostics")
.and_then(|x| x.into_dictionary());
let res = res.remove("Diagnostics").and_then(|x| x.into_dictionary());
Ok(res)
}

View File

@@ -37,11 +37,12 @@
use plist::Value;
use crate::{
IdeviceError, ReadWrite,
dvt::{
message::AuxValue,
remote_server::{Channel, RemoteServerClient},
},
obf, IdeviceError, ReadWrite,
obf,
};
/// A client for the location simulation service

View File

@@ -278,9 +278,9 @@ impl Aux {
let mut res = Vec::new();
let buffer_size = 496_u32;
res.extend_from_slice(&buffer_size.to_le_bytes()); // TODO: find what
// this means and how to actually serialize it
// go-ios just uses 496
// pymobiledevice3 doesn't seem to parse the header at all
// this means and how to actually serialize it
// go-ios just uses 496
// pymobiledevice3 doesn't seem to parse the header at all
res.extend_from_slice(&0_u32.to_le_bytes());
res.extend_from_slice(&(values_payload.len() as u32).to_le_bytes());
res.extend_from_slice(&0_u32.to_le_bytes());

View File

@@ -1,6 +1,6 @@
// Jackson Coxson
use crate::{obf, IdeviceError, ReadWrite, RsdService};
use crate::{IdeviceError, ReadWrite, RsdService, obf};
#[cfg(feature = "location_simulation")]
pub mod location_simulation;

View File

@@ -37,7 +37,7 @@
use log::warn;
use plist::{Dictionary, Value};
use crate::{dvt::message::AuxValue, obf, IdeviceError, ReadWrite};
use crate::{IdeviceError, ReadWrite, dvt::message::AuxValue, obf};
use super::remote_server::{Channel, RemoteServerClient};

View File

@@ -3,7 +3,7 @@
//! iOS automatically closes service connections if there is no heartbeat client connected and
//! responding.
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
/// Client for interacting with the iOS device heartbeat service
///

View File

@@ -6,7 +6,7 @@
use plist::{Dictionary, Value};
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
use super::afc::AfcClient;

View File

@@ -7,7 +7,7 @@ use log::error;
use plist::Value;
use serde::{Deserialize, Serialize};
use crate::{obf, pairing_file, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf, pairing_file};
/// Client for interacting with the iOS lockdown service
///

View File

@@ -6,7 +6,7 @@
use log::warn;
use plist::Dictionary;
use crate::{obf, Idevice, IdeviceError, IdeviceService, RsdService};
use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf};
/// Client for interacting with the iOS misagent service
///

View File

@@ -1300,4 +1300,3 @@ impl MobileBackup2Client {
Ok(())
}
}

View File

@@ -7,7 +7,7 @@ use chrono::{DateTime, NaiveDateTime};
use plist::Dictionary;
use tokio::io::AsyncWriteExt;
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
/// Client for interacting with the iOS device OsTraceRelay service
pub struct OsTraceRelayClient {

View File

@@ -3,7 +3,7 @@
use log::warn;
use plist::Dictionary;
use crate::{obf, IdeviceError, ReadWrite, RemoteXpcClient, RsdService};
use crate::{IdeviceError, ReadWrite, RemoteXpcClient, RsdService, obf};
/// Client for interacting with the Restore Service
pub struct RestoreServiceClient {

View File

@@ -6,7 +6,7 @@ use std::collections::HashMap;
use log::warn;
use serde::Deserialize;
use crate::{provider::RsdProvider, IdeviceError, ReadWrite, RemoteXpcClient};
use crate::{IdeviceError, ReadWrite, RemoteXpcClient, provider::RsdProvider};
/// Describes an available XPC service
#[derive(Debug, Clone, Deserialize)]

View File

@@ -3,7 +3,7 @@
//! Provides functionality for interacting with the SpringBoard services on iOS devices,
//! which manages home screen and app icon related operations.
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
/// Client for interacting with the iOS SpringBoard services
///

View File

@@ -1,6 +1,6 @@
//! iOS Device SyslogRelay Service Abstraction
use crate::{obf, Idevice, IdeviceError, IdeviceService};
use crate::{Idevice, IdeviceError, IdeviceService, obf};
/// Client for interacting with the iOS device SyslogRelay service
pub struct SyslogRelayClient {

View File

@@ -7,16 +7,16 @@
// Assuming that there's no use for unchecked certs is naive.
use rustls::{
client::{
danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier},
WebPkiServerVerifier,
},
pki_types::{pem::PemObject, CertificateDer, PrivateKeyDer, ServerName, UnixTime},
ClientConfig, DigitallySignedStruct,
client::{
WebPkiServerVerifier,
danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier},
},
pki_types::{CertificateDer, PrivateKeyDer, ServerName, UnixTime, pem::PemObject},
};
use std::sync::Arc;
use crate::{pairing_file::PairingFile, IdeviceError};
use crate::{IdeviceError, pairing_file::PairingFile};
#[derive(Debug)]
pub struct NoServerNameVerification {

View File

@@ -206,7 +206,7 @@ impl Adapter {
break;
}
ConnectionStatus::Error(e) => {
return Err(std::io::Error::new(e, "failed to connect"))
return Err(std::io::Error::new(e, "failed to connect"));
}
ConnectionStatus::WaitingForSyn => {
continue;
@@ -236,7 +236,7 @@ impl Adapter {
file.write_all(&0_i32.to_le_bytes()).await?; // timezone
file.write_all(&0_u32.to_le_bytes()).await?; // accuracy
file.write_all(&(u16::MAX as u32).to_le_bytes()).await?; // snaplen
// https://www.tcpdump.org/linktypes.html
// https://www.tcpdump.org/linktypes.html
file.write_all(&101_u32.to_le_bytes()).await?; // link type
self.pcap = Some(Arc::new(Mutex::new(file)));

View File

@@ -6,8 +6,8 @@
use std::{collections::HashMap, path::PathBuf, sync::Mutex, task::Poll};
use crossfire::{mpsc, spsc, stream::AsyncStream, AsyncRx, MTx, Tx};
use futures::{stream::FuturesUnordered, StreamExt};
use crossfire::{AsyncRx, MTx, Tx, mpsc, spsc, stream::AsyncStream};
use futures::{StreamExt, stream::FuturesUnordered};
use log::trace;
use tokio::{
io::{AsyncRead, AsyncWrite},
@@ -309,7 +309,7 @@ impl AsyncWrite for StreamHandle {
return Poll::Ready(Err(std::io::Error::new(
std::io::ErrorKind::BrokenPipe,
"channel closed",
)))
)));
}
None => break, // nothing pending
}

View File

@@ -8,7 +8,7 @@ use std::{
use log::debug;
use tokio::io::AsyncWriteExt;
use crate::{provider::RsdProvider, ReadWrite};
use crate::{ReadWrite, provider::RsdProvider};
pub mod adapter;
pub mod handle;

View File

@@ -106,4 +106,3 @@ mod tests {
}
}
}

View File

@@ -15,7 +15,7 @@ use log::{debug, warn};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use crate::{
pairing_file::PairingFile, provider::UsbmuxdProvider, Idevice, IdeviceError, ReadWrite,
Idevice, IdeviceError, ReadWrite, pairing_file::PairingFile, provider::UsbmuxdProvider,
};
mod des;

View File

@@ -5,6 +5,7 @@ check-features:
ci-check: build-ffi-native build-tools-native build-cpp build-c
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt -- --check
macos-ci-check: ci-check xcframework
cd tools && cargo build --release --target x86_64-apple-darwin
windows-ci-check: build-ffi-native build-tools-native build-cpp