Crates.io | simple-ssdp |
lib.rs | simple-ssdp |
version | 0.1.0 |
source | src |
created_at | 2024-07-06 10:43:35.239337 |
updated_at | 2024-07-06 10:43:35.239337 |
description | A SSDP implementation |
homepage | |
repository | https://github.com/MrFastDie/simple-ssdp |
max_upload_size | |
id | 1293974 |
size | 41,241 |
This is an implementation of the RFC draft from SSDP. However, it should be mostly compatible with the newer UPnP
Feel free to contribute at any point.
M-SEARCH
requestM-SEARCH
requestM-SEARCH
To launch a Service that listens and answers to M-SEARCH
requests do:
let desc = ServiceDescription {
usn_uri: "uuid:83760048-2d32-4e48-854f-f63a8fa9fd09".to_string(), // TODO get from db
service_type_uri: "AccessTime:Multicast".to_string(),
expiration: 100,
location: "https://127.0.0.1/api/v1/adopt".to_string(), // TODO get a servername from conf
};
let service = Service::new(desc);
service.listen(MulticastAddr::Loopback).await;
A client sends a M-SEARCH
request and stores a list of all answering services.
let log = LogConfig{
syslog_server: None,
syslog_port: None,
syslog_protocol: None,
log_level: Some("trace".to_string()),
};
log.initialize_logger();
let client = Client::default();
client
.discover("uuid:83760048-2d32-4e48-854f-f63a8fa9fd09".to_string(), MulticastAddr::Loopback, "AccessTime:Multicast".to_string())
.await?;
Now you can fetch a Vec<ServiceDescription>
with all answering services using client.get_services()
To be fair this is just a setup I need for another project so feel free to do whatever you like with this. So feel free to choose between:
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.