Skip to content

Commit

Permalink
1\ fix version code
Browse files Browse the repository at this point in the history
2\ show total bytes of network nic.
3\ add default target by a very big file

Signed-off-by: maintell <maintell@gmail.com>
  • Loading branch information
maintell committed Apr 12, 2022
1 parent 97c8bbe commit 87336a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/apoorvam/goterminal v0.0.0-20180523175556-614d345c47e5
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/liushuochen/gotable v0.0.0-20220408160921-3255800d3de2
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/miekg/dns v1.1.43
github.com/shirou/gopsutil v3.21.4+incompatible
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/liushuochen/gotable v0.0.0-20220408160921-3255800d3de2 h1:YJRuaK9I9EaloWTmtchFW715uSz1oATKsdTkOZzdP+Q=
github.com/liushuochen/gotable v0.0.0-20220408160921-3255800d3de2/go.mod h1:CxUy8nDvutaC1pOfaG9TRoYwdHHqoNstSPPKhomC9k8=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func LeastSquares(x []float64, y []float64) (a float64, b float64) {
}

func showStat() {

initialNetCounter, _ := netstat.IOCounters(true)
iplist := ""
if customIP !=nil && len(customIP)>0{
Expand Down Expand Up @@ -181,8 +180,10 @@ func showStat() {
// _, b := LeastSquares(x, y)
// log.Printf("Speed Vertical:%.3f\n", b)
//}
fmt.Fprintf(TerminalWriter, "Nic:%v,Recv %s/s,Send %s/s\n", netCounter[i].Name,
fmt.Fprintf(TerminalWriter, "Nic:%v,Recv %s(%s/s),Send %s(%s/s)\n", netCounter[i].Name,
readableBytes(float64(netCounter[i].BytesRecv)),
readableBytes(RecvBytes),
readableBytes(float64(netCounter[i].BytesSent)),
readableBytes(SendBytes))
}
initialNetCounter = netCounter
Expand Down Expand Up @@ -329,8 +330,8 @@ func goFun(Url string, postContent string, Referer string, XforwardFor bool, cus
wg.Done()
}
var h = flag.Bool("h", false, "this help")
var count = flag.Int("c", 16, "concurrent thread for download,default 8")
var url = flag.String("s", "https://baidu.com", "target url")
var count = flag.Int("c", 16, "concurrent thread for download,default 16")
var url = flag.String("s", "http://speedtest4.tele2.net/1GB.zip", "target url")
var postContent = flag.String("p", "", "post content")
var referer = flag.String("r", "", "referer url")
var xforwardfor = flag.Bool("f", true, "randomized X-Forwarded-For and X-Real-IP address")
Expand All @@ -340,7 +341,7 @@ var headers headersList

func usage() {
fmt.Fprintf(os.Stderr,
`webBenchmark version: /0.4
`webBenchmark version: /0.5
Usage: webBenchmark [-c concurrent] [-s target] [-p] [-r refererUrl] [-f] [-i ip]
Options:
Expand Down

0 comments on commit 87336a0

Please sign in to comment.