summaryrefslogtreecommitdiff
path: root/src/client/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/client.rs')
-rw-r--r--src/client/client.rs45
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)