aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2022-10-24 19:01:28 +0200
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2022-10-24 19:01:28 +0200
commit18824de20941bdbc3bfc1985f6cd98bd583e1f51 (patch)
tree1281d07efe0e84d46e85cfc43ba8d08e3c49562e /src
parent125f5af456e7ad978e04c91527780df9210a172d (diff)
[client & server] Add "new" methods to create Configurations
Diffstat (limited to 'src')
-rw-r--r--src/client.rs16
-rw-r--r--src/server.rs15
2 files changed, 31 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs
index 8d4ea8e..81db8d8 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -27,6 +27,22 @@ pub struct ClientConfigurationData {
local_bind_port: u16,
}
+impl ClientConfigurationData {
+ pub fn new(
+ server_host: String,
+ server_port: u16,
+ local_bind_host: String,
+ local_bind_port: u16,
+ ) -> Self {
+ Self {
+ server_host,
+ server_port,
+ local_bind_host,
+ local_bind_port,
+ }
+ }
+}
+
#[derive(Debug, PartialEq, Eq)]
enum ClientState {
Connecting,
diff --git a/src/server.rs b/src/server.rs
index 3bd58ef..a250f98 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -49,6 +49,21 @@ pub struct ServerConfigurationData {
local_bind_host: String,
}
+impl ServerConfigurationData {
+ pub fn new(
+ host: String,
+ port: u16,
+ local_bind_host: String,
+ ) -> Self {
+ Self {
+ host,
+ port,
+ local_bind_host,
+ }
+ }
+}
+
+
#[derive(Debug)]
pub struct ClientPayload {
client_id: ClientId,