Replace static str with borrowed cow for service names

This commit is contained in:
Jackson Coxson
2025-07-09 21:37:58 -06:00
parent 6abad65f39
commit 4a5e7f34da
15 changed files with 15 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ impl<T: AsyncRead + AsyncWrite + Unpin + Send + Sync + std::fmt::Debug> ReadWrit
/// device connection protocol. /// device connection protocol.
pub trait IdeviceService: Sized { pub trait IdeviceService: Sized {
/// Returns the service name as advertised by the device /// Returns the service name as advertised by the device
fn service_name() -> &'static str; fn service_name() -> std::borrow::Cow<'static, str>;
/// Establishes a connection to this service /// Establishes a connection to this service
/// ///

View File

@@ -61,7 +61,7 @@ pub struct DeviceInfo {
} }
impl IdeviceService for AfcClient { impl IdeviceService for AfcClient {
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.afc") obf!("com.apple.afc")
} }

View File

@@ -12,7 +12,7 @@ pub struct AmfiClient {
impl IdeviceService for AmfiClient { impl IdeviceService for AmfiClient {
/// Returns the amfi service name as registered with lockdownd /// Returns the amfi service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.amfi.lockdown") obf!("com.apple.amfi.lockdown")
} }

View File

@@ -93,7 +93,7 @@ pub struct CoreDeviceProxy {
impl IdeviceService for CoreDeviceProxy { impl IdeviceService for CoreDeviceProxy {
/// Returns the name of the service used for launching the CoreDeviceProxy. /// Returns the name of the service used for launching the CoreDeviceProxy.
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.internal.devicecompute.CoreDeviceProxy") obf!("com.apple.internal.devicecompute.CoreDeviceProxy")
} }

View File

@@ -22,7 +22,7 @@ pub struct CrashReportCopyMobileClient {
impl IdeviceService for CrashReportCopyMobileClient { impl IdeviceService for CrashReportCopyMobileClient {
/// Returns the name of the CrashReportCopyMobile service. /// Returns the name of the CrashReportCopyMobile service.
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.crashreportcopymobile") obf!("com.apple.crashreportcopymobile")
} }

View File

@@ -19,7 +19,7 @@ pub struct HeartbeatClient {
impl IdeviceService for HeartbeatClient { impl IdeviceService for HeartbeatClient {
/// Returns the heartbeat service name as registered with lockdownd /// Returns the heartbeat service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.mobile.heartbeat") obf!("com.apple.mobile.heartbeat")
} }

View File

@@ -21,7 +21,7 @@ pub struct HouseArrestClient {
impl IdeviceService for HouseArrestClient { impl IdeviceService for HouseArrestClient {
/// Returns the name of the HouseArrest service as registered with lockdownd /// Returns the name of the HouseArrest service as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.mobile.house_arrest") obf!("com.apple.mobile.house_arrest")
} }

View File

@@ -21,7 +21,7 @@ pub struct InstallationProxyClient {
impl IdeviceService for InstallationProxyClient { impl IdeviceService for InstallationProxyClient {
/// Returns the installation proxy service name as registered with lockdownd /// Returns the installation proxy service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.mobile.installation_proxy") obf!("com.apple.mobile.installation_proxy")
} }

View File

@@ -22,7 +22,7 @@ pub struct LockdownClient {
impl IdeviceService for LockdownClient { impl IdeviceService for LockdownClient {
/// Returns the lockdown service name as registered with the device /// Returns the lockdown service name as registered with the device
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.mobile.lockdown") obf!("com.apple.mobile.lockdown")
} }

View File

@@ -21,7 +21,7 @@ pub struct MisagentClient {
impl IdeviceService for MisagentClient { impl IdeviceService for MisagentClient {
/// Returns the misagent service name as registered with lockdownd /// Returns the misagent service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.misagent") obf!("com.apple.misagent")
} }

View File

@@ -29,7 +29,7 @@ pub struct ImageMounter {
impl IdeviceService for ImageMounter { impl IdeviceService for ImageMounter {
/// Returns the image mounter service name as registered with lockdownd /// Returns the image mounter service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.mobile.mobile_image_mounter") obf!("com.apple.mobile.mobile_image_mounter")
} }

View File

@@ -17,7 +17,7 @@ pub struct OsTraceRelayClient {
impl IdeviceService for OsTraceRelayClient { impl IdeviceService for OsTraceRelayClient {
/// Returns the OsTraceRelay service name as registered with lockdownd /// Returns the OsTraceRelay service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.os_trace_relay") obf!("com.apple.os_trace_relay")
} }

View File

@@ -16,7 +16,7 @@ pub struct SpringBoardServicesClient {
impl IdeviceService for SpringBoardServicesClient { impl IdeviceService for SpringBoardServicesClient {
/// Returns the SpringBoard services name as registered with lockdownd /// Returns the SpringBoard services name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.springboardservices") obf!("com.apple.springboardservices")
} }

View File

@@ -10,7 +10,7 @@ pub struct SyslogRelayClient {
impl IdeviceService for SyslogRelayClient { impl IdeviceService for SyslogRelayClient {
/// Returns the SyslogRelay service name as registered with lockdownd /// Returns the SyslogRelay service name as registered with lockdownd
fn service_name() -> &'static str { fn service_name() -> std::borrow::Cow<'static, str> {
obf!("com.apple.syslog_relay") obf!("com.apple.syslog_relay")
} }

View File

@@ -132,7 +132,7 @@ macro_rules! obf {
($lit:literal) => {{ ($lit:literal) => {{
#[cfg(feature = "obfuscate")] #[cfg(feature = "obfuscate")]
{ {
obfstr::xref!($lit) std::borrow::Cow::Owned(obfstr::obfstr!($lit).to_string())
} }
#[cfg(not(feature = "obfuscate"))] #[cfg(not(feature = "obfuscate"))]
{ {