From 8706541aa980a276f117462405c3fdadc933adb1 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 18 May 2023 13:06:49 +0800 Subject: [PATCH] fix ci --- libs/hbb_common/src/lib.rs | 3 ++- libs/hbb_common/src/socket_client.rs | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/hbb_common/src/lib.rs b/libs/hbb_common/src/lib.rs index ba21edc7e..3678f6bbb 100644 --- a/libs/hbb_common/src/lib.rs +++ b/libs/hbb_common/src/lib.rs @@ -287,7 +287,7 @@ pub fn get_time() -> i64 { #[inline] pub fn is_ipv4_str(id: &str) -> bool { - regex::Regex::new(r"^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$") + regex::Regex::new(r"^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:\d+)?$") .unwrap() .is_match(id) } @@ -399,6 +399,7 @@ mod test { #[test] fn test_ipv4() { assert!(is_ipv4_str("1.2.3.4")); + assert!(is_ipv4_str("1.2.3.4:90")); assert!(is_ipv4_str("192.168.0.1")); assert!(is_ipv4_str("0.0.0.0")); assert!(is_ipv4_str("255.255.255.255")); diff --git a/libs/hbb_common/src/socket_client.rs b/libs/hbb_common/src/socket_client.rs index abaf85cf7..2d9b5a984 100644 --- a/libs/hbb_common/src/socket_client.rs +++ b/libs/hbb_common/src/socket_client.rs @@ -229,10 +229,10 @@ mod tests { async fn test_nat64_async() { assert_eq!(ipv4_to_ipv6("1.1.1.1".to_owned(), true), "1.1.1.1"); assert_eq!(ipv4_to_ipv6("1.1.1.1".to_owned(), false), "1.1.1.1.nip.io"); - // assert_eq!( - // ipv4_to_ipv6("1.1.1.1:8080".to_owned(), false), - // "1.1.1.1.nip.io:8080" - // ); + assert_eq!( + ipv4_to_ipv6("1.1.1.1:8080".to_owned(), false), + "1.1.1.1.nip.io:8080" + ); assert_eq!( ipv4_to_ipv6("rustdesk.com".to_owned(), false), "rustdesk.com"