mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-20 11:40:55 +03:00
reduce visibility of some structs
This commit is contained in:
@@ -24,7 +24,7 @@ impl DnsResolver {
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) async fn resolve(&self, host: &str) -> Result<Vec<IpAddr>, Box<dyn Error>> {
|
||||
async fn resolve(&self, host: &str) -> Result<Vec<IpAddr>, Box<dyn Error>> {
|
||||
let response = self.resolver.lookup_ip(host).await?;
|
||||
for ip in response.iter() {
|
||||
log::info!("{host}: adding ip {ip}");
|
||||
@@ -32,7 +32,7 @@ impl DnsResolver {
|
||||
Ok(response.iter().collect())
|
||||
}
|
||||
|
||||
pub async fn run(mut self, server: Server) {
|
||||
pub(crate) async fn run(mut self, server: Server) {
|
||||
tokio::select! {
|
||||
_ = server.cancelled() => {},
|
||||
_ = self.do_dns(&server) => {},
|
||||
@@ -56,7 +56,7 @@ impl DnsResolver {
|
||||
};
|
||||
|
||||
/* FIXME race -> need some other event */
|
||||
server.notify_client_update(handle);
|
||||
server.client_resolved(handle);
|
||||
|
||||
log::info!("resolving ({handle}) `{hostname}` ...");
|
||||
let ips = match self.resolve(&hostname).await {
|
||||
@@ -76,7 +76,7 @@ impl DnsResolver {
|
||||
s.ips = addrs;
|
||||
s.resolving = false;
|
||||
}
|
||||
server.notify_client_update(handle);
|
||||
server.client_resolved(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ impl Server {
|
||||
self.notify_frontend(FrontendEvent::PortChanged(port, msg));
|
||||
}
|
||||
|
||||
pub(crate) fn notify_client_update(&self, handle: ClientHandle) {
|
||||
pub(crate) fn client_resolved(&self, handle: ClientHandle) {
|
||||
let state = self.client_manager.borrow().get(handle).cloned();
|
||||
if let Some((config, state)) = state {
|
||||
self.notify_frontend(FrontendEvent::State(handle, config, state));
|
||||
@@ -373,7 +373,7 @@ impl Server {
|
||||
handle
|
||||
}
|
||||
|
||||
pub async fn deactivate_client(
|
||||
async fn deactivate_client(
|
||||
&self,
|
||||
capture: &Sender<CaptureEvent>,
|
||||
emulate: &Sender<EmulationEvent>,
|
||||
@@ -390,7 +390,7 @@ impl Server {
|
||||
log::debug!("deactivating client {handle} done");
|
||||
}
|
||||
|
||||
pub async fn activate_client(
|
||||
async fn activate_client(
|
||||
&self,
|
||||
capture: &Sender<CaptureEvent>,
|
||||
emulate: &Sender<EmulationEvent>,
|
||||
@@ -423,7 +423,7 @@ impl Server {
|
||||
log::debug!("activating client {handle} done");
|
||||
}
|
||||
|
||||
pub async fn remove_client(
|
||||
async fn remove_client(
|
||||
&self,
|
||||
capture: &Sender<CaptureEvent>,
|
||||
emulate: &Sender<EmulationEvent>,
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::{client::ClientHandle, frontend::Status, server::State};
|
||||
use super::Server;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum LanMouseCaptureError {
|
||||
pub(crate) enum LanMouseCaptureError {
|
||||
#[error("error creating input-capture: `{0}`")]
|
||||
Create(#[from] CaptureCreationError),
|
||||
#[error("error while capturing input: `{0}`")]
|
||||
@@ -27,7 +27,7 @@ pub enum LanMouseCaptureError {
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CaptureEvent {
|
||||
pub(crate) enum CaptureEvent {
|
||||
/// capture must release the mouse
|
||||
Release,
|
||||
/// add a capture client
|
||||
@@ -36,7 +36,7 @@ pub enum CaptureEvent {
|
||||
Destroy(CaptureHandle),
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
server: Server,
|
||||
capture_rx: Receiver<CaptureEvent>,
|
||||
udp_send: Sender<(Event, SocketAddr)>,
|
||||
|
||||
@@ -21,7 +21,7 @@ use input_event::{Event, KeyboardEvent};
|
||||
use super::{network_task::NetworkError, CaptureEvent, Server};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum EmulationEvent {
|
||||
pub(crate) enum EmulationEvent {
|
||||
/// create a new client
|
||||
Create(EmulationHandle),
|
||||
/// destroy a client
|
||||
@@ -30,7 +30,7 @@ pub enum EmulationEvent {
|
||||
ReleaseKeys(ClientHandle),
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
server: Server,
|
||||
emulation_rx: Receiver<EmulationEvent>,
|
||||
udp_rx: Receiver<Result<(Event, SocketAddr), NetworkError>>,
|
||||
|
||||
@@ -11,7 +11,7 @@ use input_event::{Event, ProtocolError};
|
||||
|
||||
use super::Server;
|
||||
|
||||
pub async fn new(
|
||||
pub(crate) async fn new(
|
||||
server: Server,
|
||||
udp_recv_tx: Sender<Result<(Event, SocketAddr), NetworkError>>,
|
||||
udp_send_rx: Receiver<(Event, SocketAddr)>,
|
||||
|
||||
@@ -10,7 +10,7 @@ use super::{capture_task::CaptureEvent, emulation_task::EmulationEvent, Server,
|
||||
|
||||
const MAX_RESPONSE_TIME: Duration = Duration::from_millis(500);
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
server: Server,
|
||||
sender_ch: Sender<(Event, SocketAddr)>,
|
||||
emulate_notify: Sender<EmulationEvent>,
|
||||
|
||||
Reference in New Issue
Block a user