File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 11package coldfire
22
33import (
4+ "bufio"
45 "fmt"
56 "io"
67 "io/ioutil"
@@ -10,13 +11,13 @@ import (
1011 "os"
1112 "strconv"
1213 "strings"
14+
1315 //"syscall"
14- "time"
1516 "syscall"
17+ "time"
1618
1719 portscanner "github.com/anvie/port-scanner"
1820 "github.com/jackpal/gateway"
19-
2021)
2122
2223// GetGlobalIp is used to return the global Ip address of the machine.
@@ -283,4 +284,17 @@ func CloseListener(lst net.Listener){
283284 lst .Close ()
284285 lst = nil
285286 }
287+ }
288+
289+ // Returns a slice with lines of file from URL
290+ func Url2Lines (url string ) []string {
291+ resp , err := http .Get (url )
292+ Check (err )
293+ defer resp .Body .Close ()
294+ var lns []string
295+ scn := bufio .NewScanner (resp .Body )
296+ for scn .Scan () {
297+ lns = append (lns , scn .Text ())
298+ }
299+ return lns
286300}
You can’t perform that action at this time.
0 commit comments