mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-07 11:59:59 +03:00
Default port now 4242 everywhere (#14)
This commit is contained in:
committed by
GitHub
parent
f0d70492c5
commit
b74f1b4291
@@ -26,7 +26,7 @@ Where `left` can be either `left`, `right`, `top` or `bottom`.
|
|||||||
### Additional options
|
### Additional options
|
||||||
Additionally
|
Additionally
|
||||||
- a preferred backend
|
- a preferred backend
|
||||||
- a port override for the default port (2020)
|
- a port override for the default port (4242)
|
||||||
|
|
||||||
can be specified.
|
can be specified.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# example configuration
|
# example configuration
|
||||||
|
|
||||||
# optional port
|
# optional port
|
||||||
port = 2020
|
port = 4242
|
||||||
# optional backend override
|
# optional backend override
|
||||||
backend = "wlroots"
|
backend = "wlroots"
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@ backend = "wlroots"
|
|||||||
host_name = "iridium"
|
host_name = "iridium"
|
||||||
# optional ip address
|
# optional ip address
|
||||||
ip = "192.168.178.141"
|
ip = "192.168.178.141"
|
||||||
# optional port (defaults to 2020)
|
# optional port (defaults to 4242)
|
||||||
port = 2020
|
port = 4242
|
||||||
|
|
||||||
# define a client on the left side with IP address 192.168.178.189
|
# define a client on the left side with IP address 192.168.178.189
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{net::SocketAddr, error::Error, fmt::Display, sync::{Arc, atomic::{AtomicBool, Ordering, AtomicU32}, RwLock}};
|
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)]
|
#[derive(Eq, Hash, PartialEq, Clone, Copy)]
|
||||||
pub enum Position {
|
pub enum Position {
|
||||||
@@ -56,7 +56,7 @@ impl ClientManager {
|
|||||||
None => return Err(Box::new(ClientConfigError{})),
|
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);
|
self.register_client(addr, pos);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use toml;
|
|||||||
|
|
||||||
use crate::client::Position;
|
use crate::client::Position;
|
||||||
|
|
||||||
|
pub const DEFAULT_PORT: u16 = 4242;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct ConfigToml {
|
pub struct ConfigToml {
|
||||||
pub port: Option<u16>,
|
pub port: Option<u16>,
|
||||||
@@ -86,8 +88,6 @@ impl Config {
|
|||||||
backend => backend,
|
backend => backend,
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_PORT: u16 = 4242;
|
|
||||||
|
|
||||||
let port = match find_arg("--port")? {
|
let port = match find_arg("--port")? {
|
||||||
Some(port) => port.parse::<u16>()?,
|
Some(port) => port.parse::<u16>()?,
|
||||||
None => match &config_toml {
|
None => match &config_toml {
|
||||||
|
|||||||
Reference in New Issue
Block a user