mirror of
https://github.com/ekzhang/bore.git
synced 2025-12-15 19:37:47 +01:00
use IpAddr type for validation and add error messages
From: https://github.com/ekzhang/bore/pull/162#discussion_r2042195219
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#![allow(clippy::items_after_test_module)]
|
||||
|
||||
use std::net::SocketAddr;
|
||||
use std::net::IpAddr;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
@@ -23,8 +24,8 @@ async fn spawn_server(secret: Option<&str>) {
|
||||
Server::new(
|
||||
1024..=65535,
|
||||
secret,
|
||||
"0.0.0.0".to_string(),
|
||||
"0.0.0.0".to_string(),
|
||||
"0.0.0.0".parse::<IpAddr>().unwrap(),
|
||||
"0.0.0.0".parse::<IpAddr>().unwrap(),
|
||||
)
|
||||
.listen(),
|
||||
);
|
||||
@@ -136,7 +137,7 @@ fn empty_port_range() {
|
||||
let _ = Server::new(
|
||||
min_port..=max_port,
|
||||
None,
|
||||
"0.0.0.0".to_string(),
|
||||
"0.0.0.0".to_string(),
|
||||
"0.0.0.0".parse::<IpAddr>().unwrap(),
|
||||
"0.0.0.0".parse::<IpAddr>().unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user