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

doc: update doc for netutil package

This commit is contained in:
dudaodong
2023-04-19 16:19:42 +08:00
parent db34b5f69c
commit b419319e66
3 changed files with 9 additions and 16 deletions

View File

@@ -916,9 +916,8 @@ import (
)
func main() {
ok, err := netutil.DownloadFile("./", "http://www.xxx.com/a.jpg")
err := DownloadFile("./lancet_logo.jpg", "https://picx.zhimg.com/v2-fc82a4199749de9cfb71e32e54f489d3_720w.jpg?source=172ae18b")
fmt.Println(ok)
fmt.Println(err)
}
```
@@ -939,10 +938,7 @@ func IsPingConnected(host string) bool
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/duke-git/lancet/netutil"
)
@@ -975,10 +971,7 @@ func IsTelnetConnected(host string, port string) bool
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/duke-git/lancet/netutil"
)

View File

@@ -915,9 +915,8 @@ import (
)
func main() {
ok, err := netutil.DownloadFile("./", "http://www.xxx.com/a.jpg")
err := DownloadFile("./lancet_logo.jpg", "https://picx.zhimg.com/v2-fc82a4199749de9cfb71e32e54f489d3_720w.jpg?source=172ae18b")
fmt.Println(ok)
fmt.Println(err)
}
```
@@ -938,10 +937,7 @@ func IsPingConnected(host string) bool
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/duke-git/lancet/netutil"
)
@@ -974,10 +970,7 @@ func IsTelnetConnected(host string, port string) bool
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/duke-git/lancet/netutil"
)

View File

@@ -72,3 +72,10 @@ func TestTelnetConnected(t *testing.T) {
result2 := IsTelnetConnected("www.baidu.com", "123")
assert.Equal(false, result2)
}
// func TestDownloadFile(t *testing.T) {
// assert := internal.NewAssert(t, "TestDownloadFile")
// err := DownloadFile("./lancet_logo.jpg", "https://picx.zhimg.com/v2-fc82a4199749de9cfb71e32e54f489d3_720w.jpg?source=172ae18b")
// assert.IsNil(err)
// }