1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-11 08:12:26 +08:00

doc: add document and example for IsPingConnected and IsTelnetConnected

This commit is contained in:
dudaodong
2023-04-19 11:48:28 +08:00
parent c137428b9e
commit f73c7e7e86
3 changed files with 177 additions and 5 deletions

View File

@@ -178,3 +178,27 @@ func ExampleConvertMapToQueryString() {
// Output:
// a=1&b=2&c=3
}
func ExampleIsPingConnected() {
result1 := IsPingConnected("www.baidu.com")
result2 := IsPingConnected("www.!@#&&&.com")
fmt.Println(result1)
fmt.Println(result2)
// Output:
// true
// false
}
func ExampleIsTelnetConnected() {
result1 := IsTelnetConnected("www.baidu.com", "80")
result2 := IsTelnetConnected("www.baidu.com", "123")
fmt.Println(result1)
fmt.Println(result2)
// Output:
// true
// false
}