Hansie Odendaal c80c3fd2e3
chore: config and naming updates (#27)
* Update config and crate naming

- Updated configs to the lates main repo configs.
- Updated all main repo crate namings to be same as the main repo.
- Added `create_dir_all` to `pub(crate) fn create_tempdir(custom_work_dir: Option<PathBuf>) -> std::io::Result<TempDir> {`.
- Wired in optional `persist_dir` when using the local deployer.
- Update `time` vulnerability

**Note:** Unsure about the `service_params` mapping in `pub(crate) fn cryptarchia_deployment(config: &GeneralConfig) -> CryptarchiaDeploymentSettings {`
2026-02-09 10:28:15 +02:00

20 lines
499 B
Rust

use lb_libp2p::{Multiaddr, Protocol};
pub fn extract_udp_port(addr: &Multiaddr) -> Option<u16> {
addr.iter().find_map(|protocol| {
if let Protocol::Udp(port) = protocol {
Some(port)
} else {
None
}
})
}
pub fn find_matching_host(addr: &Multiaddr, original_ports: &[u16]) -> Option<usize> {
extract_udp_port(addr).and_then(|port| {
original_ports
.iter()
.position(|candidate| *candidate == port)
})
}