增加runtime.GOOS判断系统环境
This commit is contained in:
parent
5bb50ce86d
commit
7ff5cfaaf8
|
@ -6,6 +6,7 @@ import (
|
|||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
@ -78,8 +79,11 @@ func ExportCsv(data []CloudflareIPData) {
|
|||
return
|
||||
}
|
||||
defer fp.Close()
|
||||
w := csv.NewWriter(fp) //创建一个新的写入文件流
|
||||
w.Write([]string{"\xEF\xBB\xBF"}) //增加修改boom头.中文正常显示
|
||||
w := csv.NewWriter(fp) //创建一个新的写入文件流
|
||||
if runtime.GOOS == "windows" { //判断系统是否为windows
|
||||
_ = w.Write([]string{"\xEF\xBB\xBF"}) //增加修改bom头.中文正常显示
|
||||
}
|
||||
|
||||
_ = w.Write([]string{"IP 地址", "已发送", "已接收", "丢包率", "平均延迟", "下载速度 (MB/s)"})
|
||||
_ = w.WriteAll(convertToString(data))
|
||||
w.Flush()
|
||||
|
|
Loading…
Reference in New Issue