tangled
alpha
login
or
join now
vielle.dev
/
wol
1
fork
atom
[WIP] A simple wake-on-lan service
1
fork
atom
overview
issues
pulls
pipelines
implement /ping
vielle.dev
4 days ago
10d5f51f
648ca39a
verified
This commit was signed with the committer's
known signature
.
vielle.dev
SSH Key Fingerprint:
SHA256:EoUuRRBFQKUfYh74C568g83i9g4fVi5OTtOENMSfa+0=
+16
-5
3 changed files
expand all
collapse all
unified
split
Cargo.lock
Cargo.toml
src
server
ping.rs
+12
Cargo.lock
···
742
742
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
743
743
744
744
[[package]]
745
745
+
name = "ping"
746
746
+
version = "0.7.1"
747
747
+
source = "registry+https://github.com/rust-lang/crates.io-index"
748
748
+
checksum = "044b1fa4f259f4df9ad5078e587b208f5d288a25407575fcddb9face30c7c692"
749
749
+
dependencies = [
750
750
+
"rand",
751
751
+
"socket2",
752
752
+
"thiserror 2.0.18",
753
753
+
]
754
754
+
755
755
+
[[package]]
745
756
name = "potential_utf"
746
757
version = "0.1.4"
747
758
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1908
1919
version = "0.1.0"
1909
1920
dependencies = [
1910
1921
"axum",
1922
1922
+
"ping",
1911
1923
"reqwest",
1912
1924
"serde",
1913
1925
"serde_json",
+1
Cargo.toml
···
11
11
axum = "0.8.8"
12
12
serde_json = "1.0.149"
13
13
reqwest = "0.13.2"
14
14
+
ping = "0.7.1"
14
15
15
16
[build-dependencies]
16
17
serde = { version = "1.0.228", features = ["derive"] }
+3
-5
src/server/ping.rs
···
1
1
use std::net::IpAddr;
2
2
3
3
-
use axum::{Json, extract::Query, http::Response};
3
3
+
use axum::{Json, extract::Query};
4
4
use serde::Deserialize;
5
5
6
6
#[derive(Deserialize)]
···
9
9
ip: IpAddr,
10
10
}
11
11
12
12
-
pub async fn main(Query(req): Query<PingRequest>) -> Result<Json<bool>, Response<String>> {
13
13
-
println!("Pinging {}", req.ip);
14
14
-
15
15
-
Ok(Json(false))
12
12
+
pub async fn main(Query(req): Query<PingRequest>) -> Json<bool> {
13
13
+
Json(ping::new(req.ip).send().is_ok())
16
14
}