Adds a mdns resolver/state-machine crate for providing MDNS-SD functionality for an embedded device.
.tangled/workflows/miri.yml
.tangled/workflows/miri.yml
This file has not been changed.
Cargo.lock
Cargo.lock
This file has not been changed.
Cargo.toml
Cargo.toml
This file has not been changed.
sachy-mdns/Cargo.toml
sachy-mdns/Cargo.toml
This file has not been changed.
sachy-mdns/src/dns.rs
sachy-mdns/src/dns.rs
This file has not been changed.
sachy-mdns/src/dns/flags.rs
sachy-mdns/src/dns/flags.rs
This file has not been changed.
+2
-1
sachy-mdns/src/dns/label.rs
+2
-1
sachy-mdns/src/dns/label.rs
sachy-mdns/src/dns/query.rs
sachy-mdns/src/dns/query.rs
This file has not been changed.
sachy-mdns/src/dns/records.rs
sachy-mdns/src/dns/records.rs
This file has not been changed.
+2
sachy-mdns/src/dns/reqres.rs
+2
sachy-mdns/src/dns/reqres.rs
···
226
226
227
227
#[test]
228
228
fn parse_response_two_records() {
229
+
#[rustfmt::skip]
229
230
let data = [
230
231
0xAA, 0xAA, //
231
232
0x81, 0x80, //
···
345
346
346
347
#[test]
347
348
fn parse_response_back_forth() {
349
+
#[rustfmt::skip]
348
350
let data = [
349
351
0, 0, // Transaction ID
350
352
132, 0, // Response, Authoritative Answer, No Recursion
sachy-mdns/src/dns/traits.rs
sachy-mdns/src/dns/traits.rs
This file has not been changed.
sachy-mdns/src/encoder.rs
sachy-mdns/src/encoder.rs
This file has not been changed.
sachy-mdns/src/lib.rs
sachy-mdns/src/lib.rs
This file has not been changed.
+19
-11
sachy-mdns/src/server.rs
+19
-11
sachy-mdns/src/server.rs
···
74
74
Request::parse(&mut &incoming[..], incoming)
75
75
.ok()
76
76
.and_then(|req| {
77
-
let valid_queries = req
78
-
.queries
79
-
.iter()
80
-
.filter_map(|q| match q.qtype {
81
-
QType::A | QType::AAAA | QType::TXT | QType::SRV => {
82
-
(q.name == self.service.hostname()).then_some((q.qtype, q.qclass))
83
-
}
84
-
QType::PTR => (q.name == self.service.service_type()).then_some((q.qtype, q.qclass)),
85
-
QType::Any | QType::Unknown(_) => None,
86
-
}).collect::<Vec<_>>();
77
+
let valid_queries =
78
+
req.queries
79
+
.iter()
80
+
.filter_map(|q| match q.qtype {
81
+
QType::A | QType::AAAA | QType::TXT | QType::SRV => {
82
+
(q.name == self.service.hostname()).then_some((q.qtype, q.qclass))
83
+
}
84
+
QType::PTR => (q.name == self.service.service_type())
85
+
.then_some((q.qtype, q.qclass)),
86
+
QType::Any | QType::Unknown(_) => None,
87
+
})
88
+
.collect::<Vec<_>>();
87
89
88
90
if !valid_queries.is_empty() {
89
-
self.broadcast(ResponseKind::QueryResponse(valid_queries), req.flags, req.id, req.queries, outgoing)
91
+
self.broadcast(
92
+
ResponseKind::QueryResponse(valid_queries),
93
+
req.flags,
94
+
req.id,
95
+
req.queries,
96
+
outgoing,
97
+
)
90
98
} else {
91
99
None
92
100
}
sachy-mdns/src/service.rs
sachy-mdns/src/service.rs
This file has not been changed.
sachy-mdns/src/state.rs
sachy-mdns/src/state.rs
This file has not been changed.
History
2 rounds
0 comments
1 commit
expand
collapse
feat: WIP MDNS crate
Adds a mdns resolver/state-machine crate for providing MDNS-SD functionality for an embedded device.
2/2 success
expand
collapse
expand 0 comments
pull request successfully merged
1 commit
expand
collapse
feat: WIP MDNS crate
Adds a mdns resolver/state-machine crate for providing MDNS-SD functionality for an embedded device.