1st integration for client
All checks were successful
/ test (push) Successful in 13s

This commit is contained in:
Robert Schauklies 2025-01-11 16:45:07 +01:00
parent 501a82760d
commit b33fe3ccaf
3 changed files with 28 additions and 2 deletions

View file

@ -6,3 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
semserialize = {path='../libs/semserialize'}
postcard = "1.0.0"
serde = { version = "1.0.*"}
argh = "0.1.13"

View file

@ -1,3 +1,24 @@
fn main() {
println!("Hello, world!"); use semserialize::SemLine;
use serde::{Serialize, Deserialize};
use postcard::{from_bytes};
use argh::FromArgs;
use std::net;
#[derive(FromArgs)]
///Config options for the client
struct Config {
///listener IP, defaults to 0.0.0.0
#[argh(option, default = "String::from(\"0.0.0.0\")",short='i')]
ip: String,
///listener port
#[argh(option, default = "2137",short='p')]
udpport: usize,
}
fn main() {
let config:Config = argh::from_env();
println!("UDP listener Port is {}",config.udpport);
let socket_addr:std::net::SocketAddr = format!("{}:{}",config.ip,config.udpport).parse::<std::net::SocketAddr>().unwrap_or("0.0.0.0:2137".parse::<std::net::SocketAddr>().unwrap());
let udpsocket = std::net::UdpSocket::bind(socket_addr).expect("couldn't bind to address");
} }

View file

@ -11,6 +11,7 @@ let rust-toolchain = with pkgs; symlinkJoin {
]; ];
}; };
in pkgs.mkShell { in pkgs.mkShell {
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
buildInputs = [rust-toolchain]; buildInputs = [rust-toolchain];
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
} }