From b74f1b429168757670f882e0fdbf4f9d17f8c760 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Sun, 11 Jun 2023 21:54:40 +0200 Subject: [PATCH] Default port now 4242 everywhere (#14) --- README.md | 2 +- config.toml | 6 +++--- src/client.rs | 4 ++-- src/config.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 553dbd3..7eb3e6e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Where `left` can be either `left`, `right`, `top` or `bottom`. ### Additional options Additionally - a preferred backend -- a port override for the default port (2020) +- a port override for the default port (4242) can be specified. diff --git a/config.toml b/config.toml index 0ecad99..6e6ef91 100644 --- a/config.toml +++ b/config.toml @@ -1,7 +1,7 @@ # example configuration # optional port -port = 2020 +port = 4242 # optional backend override backend = "wlroots" @@ -11,8 +11,8 @@ backend = "wlroots" host_name = "iridium" # optional ip address ip = "192.168.178.141" -# optional port (defaults to 2020) -port = 2020 +# optional port (defaults to 4242) +port = 4242 # define a client on the left side with IP address 192.168.178.189 # diff --git a/src/client.rs b/src/client.rs index c855a66..b38daa7 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,6 +1,6 @@ use std::{net::SocketAddr, error::Error, fmt::Display, sync::{Arc, atomic::{AtomicBool, Ordering, AtomicU32}, RwLock}}; -use crate::{config, dns}; +use crate::{config::{self, DEFAULT_PORT}, dns}; #[derive(Eq, Hash, PartialEq, Clone, Copy)] pub enum Position { @@ -56,7 +56,7 @@ impl ClientManager { None => return Err(Box::new(ClientConfigError{})), }, }; - let addr = SocketAddr::new(ip, client.port.unwrap_or(2020)); + let addr = SocketAddr::new(ip, client.port.unwrap_or(DEFAULT_PORT)); self.register_client(addr, pos); Ok(()) } diff --git a/src/config.rs b/src/config.rs index 9b54d45..519f25d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -8,6 +8,8 @@ use toml; use crate::client::Position; +pub const DEFAULT_PORT: u16 = 4242; + #[derive(Serialize, Deserialize, Debug)] pub struct ConfigToml { pub port: Option, @@ -86,8 +88,6 @@ impl Config { backend => backend, }; - const DEFAULT_PORT: u16 = 4242; - let port = match find_arg("--port")? { Some(port) => port.parse::()?, None => match &config_toml {