test: 增加endpoint的单元测试

This commit is contained in:
shiro.lee
2024-07-05 15:45:33 +08:00
parent 9db3a04275
commit edb2016b28
2 changed files with 168 additions and 14 deletions
+2 -2
View File
@@ -11,10 +11,10 @@ lazy_static! {
}
/// helper for validating if the provided arg is an ip address.
pub fn is_socket_addr(host: &str) -> bool {
pub fn is_socket_addr(addr: &str) -> bool {
// TODO IPv6 zone information?
host.parse::<SocketAddr>().is_ok() || host.parse::<IpAddr>().is_ok()
addr.parse::<SocketAddr>().is_ok() || addr.parse::<IpAddr>().is_ok()
}
/// checks if server_addr is valid and local host.