This commit is contained in:
2026-07-09 22:15:26 +05:30
parent 0d9af8f605
commit 3664e70c5d
5 changed files with 54 additions and 40 deletions
+19 -12
View File
@@ -9,9 +9,17 @@ fn main() -> WResult<()> {
return Ok(());
};
let wolz = Wolz::create()?;
wolz.wake_up(&arg_1)?;
Ok(())
match arg_1.as_str() {
"-h" | "--help" => {
print_usage();
return Ok(());
}
_ => {
let wolz = Wolz::create()?;
wolz.wake_up(&arg_1)?;
Ok(())
}
}
}
fn print_usage() {
@@ -20,20 +28,19 @@ fn print_usage() {
r#"usage: woly ARG
Options:
ARG Either the mac address of the device to send the wol magic
packet to, or a nickname specified in woly.conf to lookup
the mac.
Eg: woly aa:bb:cc:dd:ee:ff
Eg: woly potato
where potato is configured in the woly.conf file as
potato=aa:bb:cc:dd:ee:ff
ARG Either the mac address of the device to send the wol magic
packet to, or a nickname specified in woly.conf to lookup
the mac. See details about config file below.
Eg: woly aa:bb:cc:dd:ee:ff
Eg: woly potato
Config file:
Filename woly.conf
Location $WOLY_CONFIG_DIR/woly.conf, then $XDG_CONFIG_DIR/woly.conf,
then $HOME/woly.conf
Format one KEY=VALUE per line without spaces
Example potato=aa:bb:cc:dd:ee:ff
Format KEY=VALUE
one per line without spaces, no comments allowed
Example potato=aa:bb:cc:dd:ee:ff
idly=12:34:23:e2:3d:ff
"#
);
+1 -1
View File
@@ -11,7 +11,7 @@ use std::{
fn main() -> DResult<()> {
let address = "0.0.0.0:21367";
let listener = TcpListener::bind(address).map_err(DError::TcpBindError)?;
println!("Listening on {}", address);
println!("Listening for TCP packets at {}", address);
for mut stream in listener.incoming() {
match &mut stream {
Ok(stream) => {
+1
View File
@@ -47,6 +47,7 @@ impl Config {
&nick.name
)))
.map(|mac| mac.clone()),
Device::IpV4(ip_v4) => todo!(),
}
}
-3
View File
@@ -30,7 +30,4 @@ impl Wolz {
println!("Magic packet sent to 255.255.255.255:9 for Mac {:}", mac);
Ok(())
}
pub fn shutdown(&self, ip_or_nick: &str) -> WResult<()> {
}
}