mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-17 19:22:28 +08:00
doc: update doc for netutil package
This commit is contained in:
@@ -916,9 +916,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -939,10 +938,7 @@ func IsPingConnected(host string) bool
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"github.com/duke-git/lancet/netutil"
|
"github.com/duke-git/lancet/netutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -975,10 +971,7 @@ func IsTelnetConnected(host string, port string) bool
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"github.com/duke-git/lancet/netutil"
|
"github.com/duke-git/lancet/netutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -915,9 +915,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -938,10 +937,7 @@ func IsPingConnected(host string) bool
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"github.com/duke-git/lancet/netutil"
|
"github.com/duke-git/lancet/netutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -974,10 +970,7 @@ func IsTelnetConnected(host string, port string) bool
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"github.com/duke-git/lancet/netutil"
|
"github.com/duke-git/lancet/netutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -72,3 +72,10 @@ func TestTelnetConnected(t *testing.T) {
|
|||||||
result2 := IsTelnetConnected("www.baidu.com", "123")
|
result2 := IsTelnetConnected("www.baidu.com", "123")
|
||||||
assert.Equal(false, result2)
|
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)
|
||||||
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user