This commit is contained in:
parent
501a82760d
commit
b33fe3ccaf
|
@ -6,3 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
semserialize = {path='../libs/semserialize'}
|
||||
postcard = "1.0.0"
|
||||
serde = { version = "1.0.*"}
|
||||
argh = "0.1.13"
|
||||
|
|
|
@ -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");
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ let rust-toolchain = with pkgs; symlinkJoin {
|
|||
];
|
||||
};
|
||||
in pkgs.mkShell {
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
buildInputs = [rust-toolchain];
|
||||
RUST_BACKTRACE = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue