Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4126c856d9 |
@@ -10,6 +10,10 @@ repository.workspace = true
|
|||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["mdns"]
|
||||||
|
mdns = ["dep:mdns-sd"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = { version = "0.22.1" }
|
base64 = { version = "0.22.1" }
|
||||||
bincode = { version = "1.3.3" }
|
bincode = { version = "1.3.3" }
|
||||||
@@ -18,9 +22,6 @@ chrono = { version = "0.4.40", default-features = false, features = ["std"] }
|
|||||||
homedir = { version = "= 0.3.4" }
|
homedir = { version = "= 0.3.4" }
|
||||||
image = { version = "0.25.5", default-features = false }
|
image = { version = "0.25.5", default-features = false }
|
||||||
log = { version = "0.4.26" }
|
log = { version = "0.4.26" }
|
||||||
mdns-sd = { version = "0.13.9", default-features = false, features = [
|
|
||||||
"logging",
|
|
||||||
] }
|
|
||||||
num-bigint = { version = "0.8.4", package = "num-bigint-dig" }
|
num-bigint = { version = "0.8.4", package = "num-bigint-dig" }
|
||||||
num-traits = { version = "0.2.19" }
|
num-traits = { version = "0.2.19" }
|
||||||
quick-protobuf = { version = "0.8.1" }
|
quick-protobuf = { version = "0.8.1" }
|
||||||
@@ -39,6 +40,11 @@ serde_repr = { version = "0.1.19" }
|
|||||||
sha1 = { version = "0.10.6", features = ["oid"] }
|
sha1 = { version = "0.10.6", features = ["oid"] }
|
||||||
thiserror = { version = "2.0.7" }
|
thiserror = { version = "2.0.7" }
|
||||||
|
|
||||||
|
# MDNS
|
||||||
|
mdns-sd = { version = "0.13.9", default-features = false, optional = true, features = [
|
||||||
|
"logging",
|
||||||
|
] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = { version = "1.0.93" }
|
anyhow = { version = "1.0.93" }
|
||||||
criterion = { version = "0.6.0" } # Used for benchmarks
|
criterion = { version = "0.6.0" } # Used for benchmarks
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ pub enum RustADBError {
|
|||||||
#[error("upgrade error: {0}")]
|
#[error("upgrade error: {0}")]
|
||||||
UpgradeError(String),
|
UpgradeError(String),
|
||||||
/// An error occurred while getting mdns devices
|
/// An error occurred while getting mdns devices
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
MDNSError(#[from] mdns_sd::Error),
|
MDNSError(#[from] mdns_sd::Error),
|
||||||
/// An error occurred while sending data to channel
|
/// An error occurred while sending data to channel
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ mod constants;
|
|||||||
mod device;
|
mod device;
|
||||||
mod emulator_device;
|
mod emulator_device;
|
||||||
mod error;
|
mod error;
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
mod mdns;
|
mod mdns;
|
||||||
mod models;
|
mod models;
|
||||||
mod server;
|
mod server;
|
||||||
@@ -20,6 +21,7 @@ pub use adb_device_ext::ADBDeviceExt;
|
|||||||
pub use device::{ADBTcpDevice, ADBUSBDevice, is_adb_device, search_adb_devices};
|
pub use device::{ADBTcpDevice, ADBUSBDevice, is_adb_device, search_adb_devices};
|
||||||
pub use emulator_device::ADBEmulatorDevice;
|
pub use emulator_device::ADBEmulatorDevice;
|
||||||
pub use error::{Result, RustADBError};
|
pub use error::{Result, RustADBError};
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
pub use mdns::*;
|
pub use mdns::*;
|
||||||
pub use models::{AdbStatResponse, RebootType};
|
pub use models::{AdbStatResponse, RebootType};
|
||||||
pub use server::*;
|
pub use server::*;
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ pub(crate) enum AdbServerCommand {
|
|||||||
Pair(SocketAddrV4, String),
|
Pair(SocketAddrV4, String),
|
||||||
TransportAny,
|
TransportAny,
|
||||||
TransportSerial(String),
|
TransportSerial(String),
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
MDNSCheck,
|
MDNSCheck,
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
MDNSServices,
|
MDNSServices,
|
||||||
ServerStatus,
|
ServerStatus,
|
||||||
ReconnectOffline,
|
ReconnectOffline,
|
||||||
@@ -77,7 +79,9 @@ impl Display for AdbServerCommand {
|
|||||||
write!(f, "reverse:forward:{remote};{local}")
|
write!(f, "reverse:forward:{remote};{local}")
|
||||||
}
|
}
|
||||||
AdbServerCommand::ReverseRemoveAll => write!(f, "reverse:killforward-all"),
|
AdbServerCommand::ReverseRemoveAll => write!(f, "reverse:killforward-all"),
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
AdbServerCommand::MDNSCheck => write!(f, "host:mdns:check"),
|
AdbServerCommand::MDNSCheck => write!(f, "host:mdns:check"),
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
AdbServerCommand::MDNSServices => write!(f, "host:mdns:services"),
|
AdbServerCommand::MDNSServices => write!(f, "host:mdns:services"),
|
||||||
AdbServerCommand::ServerStatus => write!(f, "host:server-status"),
|
AdbServerCommand::ServerStatus => write!(f, "host:server-status"),
|
||||||
AdbServerCommand::Reconnect => write!(f, "reconnect"),
|
AdbServerCommand::Reconnect => write!(f, "reconnect"),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use crate::{
|
|||||||
|
|
||||||
const OPENSCREEN_MDNS_BACKEND: &str = "ADB_MDNS_OPENSCREEN";
|
const OPENSCREEN_MDNS_BACKEND: &str = "ADB_MDNS_OPENSCREEN";
|
||||||
|
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
impl ADBServer {
|
impl ADBServer {
|
||||||
/// Check if mdns discovery is available
|
/// Check if mdns discovery is available
|
||||||
pub fn mdns_check(&mut self) -> Result<bool> {
|
pub fn mdns_check(&mut self) -> Result<bool> {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ mod connect;
|
|||||||
mod devices;
|
mod devices;
|
||||||
mod disconnect;
|
mod disconnect;
|
||||||
mod kill;
|
mod kill;
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
mod mdns;
|
mod mdns;
|
||||||
mod pair;
|
mod pair;
|
||||||
mod reconnect;
|
mod reconnect;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ mod adb_version;
|
|||||||
mod device_long;
|
mod device_long;
|
||||||
mod device_short;
|
mod device_short;
|
||||||
mod device_state;
|
mod device_state;
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
mod mdns_services;
|
mod mdns_services;
|
||||||
mod server_status;
|
mod server_status;
|
||||||
mod wait_for_device;
|
mod wait_for_device;
|
||||||
@@ -10,6 +11,7 @@ pub use adb_version::AdbVersion;
|
|||||||
pub use device_long::DeviceLong;
|
pub use device_long::DeviceLong;
|
||||||
pub use device_short::DeviceShort;
|
pub use device_short::DeviceShort;
|
||||||
pub use device_state::DeviceState;
|
pub use device_state::DeviceState;
|
||||||
|
#[cfg(feature = "mdns")]
|
||||||
pub use mdns_services::MDNSServices;
|
pub use mdns_services::MDNSServices;
|
||||||
pub use server_status::{MDNSBackend, ServerStatus};
|
pub use server_status::{MDNSBackend, ServerStatus};
|
||||||
pub use wait_for_device::{WaitForDeviceState, WaitForDeviceTransport};
|
pub use wait_for_device::{WaitForDeviceState, WaitForDeviceTransport};
|
||||||
|
|||||||
Reference in New Issue
Block a user