diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-09-18 18:45:36 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-09-18 18:48:42 +0800 |
| commit | d089c1611b94c6c19d2998a56d9f4d2a983f9833 (patch) | |
| tree | 862d3953653a4c878bfd9a43551346ea90ab04c7 /src/client | |
| parent | 0798c029cee16875fb09ea6a158dbab2dcf13aab (diff) | |
client: move inner info to seperate file
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/client.rs | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/client/client.rs b/src/client/client.rs index 73a2c30..5293063 100644 --- a/src/client/client.rs +++ b/src/client/client.rs @@ -6,18 +6,7 @@ use crate::connector::Connection; pub struct Client<'a, C: Connection> { pub connector: C, - - ip: Option<IpAddr>, - hostname: String, - device_name: String, - os: &'a str, - cpu_arch: &'a str, - distro: String, - desktop_env: DesktopEnv, - username: String, - realname: String, - langs: Option<Vec<Language>>, - env: Vec<(String, String)>, + inner: remote_control_rs::client::Client<'a>, } impl<'a, C: Connection> std::fmt::Display for Client<'a, C> { @@ -35,7 +24,7 @@ impl<'a, C: Connection> std::fmt::Display for Client<'a, C> { Real Name: {}\n\ Languages: {:?}\n\ Environment Variables: {:?}\n", - self.ip, self.hostname, self.device_name, self.os, self.cpu_arch, self.distro, self.desktop_env, self.username, self.realname, self.langs, self.env + self.inner.ip, self.inner.hostname, self.inner.device_name, self.inner.os, self.inner.cpu_arch, self.inner.distro, self.inner.desktop_env, self.inner.username, self.inner.realname, self.inner.langs, self.inner.env ) } } @@ -43,21 +32,23 @@ impl<'a, C: Connection> std::fmt::Display for Client<'a, C> { impl<'a, C: Connection> Client<'a, C> { pub fn new(connector: C) -> Result<Self, C::Err> { let c = Self { - ip: connector.get_ip(), - connector, - hostname: gethostname().into_string().unwrap_or_default(), - device_name: whoami::devicename(), - os: std::env::consts::OS, - cpu_arch: std::env::consts::ARCH, - distro: whoami::distro(), - desktop_env: whoami::desktop_env(), - username: whoami::username(), - realname: whoami::realname(), - langs: match whoami::langs() { - Ok(it) => Some(it.collect()), - Err(_) => None, + inner: remote_control_rs::client::Client { + ip: connector.get_ip(), + hostname: gethostname().into_string().unwrap_or_default(), + device_name: whoami::devicename(), + os: std::env::consts::OS, + cpu_arch: std::env::consts::ARCH, + distro: whoami::distro(), + desktop_env: whoami::desktop_env(), + username: whoami::username(), + realname: whoami::realname(), + langs: match whoami::langs() { + Ok(it) => Some(it.collect()), + Err(_) => None, + }, + env: std::env::vars().collect(), }, - env: std::env::vars().collect(), + connector, }; c.connector.init(&c)?; Ok(c) |
