aboutsummaryrefslogtreecommitdiff
path: root/src/wol.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2024-04-10 00:16:55 +0200
committerFxQnLr <[email protected]>2024-04-10 00:16:55 +0200
commit3428a637ce420baef9aa9f9803e71bd587867005 (patch)
treea1ad8234ae9bf3709794324a41e38c2f7fa58d0d /src/wol.rs
parent907e5cb5bc48899b444f7fedd85af7b5974d9a2e (diff)
downloadwebol-3428a637ce420baef9aa9f9803e71bd587867005.tar
webol-3428a637ce420baef9aa9f9803e71bd587867005.tar.gz
webol-3428a637ce420baef9aa9f9803e71bd587867005.zip
Closes #24. Changed postgres to json directory storage
Diffstat (limited to 'src/wol.rs')
-rw-r--r--src/wol.rs20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/wol.rs b/src/wol.rs
index 31cf350..6392366 100644
--- a/src/wol.rs
+++ b/src/wol.rs
@@ -2,26 +2,6 @@ use std::net::{ToSocketAddrs, UdpSocket};
2 2
3use crate::error::Error; 3use crate::error::Error;
4 4
5/// Creates the magic packet from a mac address
6///
7/// # Panics
8///
9/// Panics if `mac_addr` is an invalid mac
10pub fn create_buffer(mac_addr: &str) -> Result<Vec<u8>, Error> {
11 let mut mac = Vec::new();
12 let sp = mac_addr.split(':');
13 for f in sp {
14 mac.push(u8::from_str_radix(f, 16)?);
15 }
16 let mut buf = vec![255; 6];
17 for _ in 0..16 {
18 for i in &mac {
19 buf.push(*i);
20 }
21 }
22 Ok(buf)
23}
24
25/// Sends a buffer on UDP broadcast 5/// Sends a buffer on UDP broadcast
26pub fn send_packet<A: ToSocketAddrs>( 6pub fn send_packet<A: ToSocketAddrs>(
27 bind_addr: A, 7 bind_addr: A,