mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-02-18 20:23:06 +00:00
* 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 {`
20 lines
499 B
Rust
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)
|
|
})
|
|
}
|