diff options
| author | 韩丁康 <[email protected]> | 2023-11-14 10:24:42 +0800 |
|---|---|---|
| committer | 韩丁康 <[email protected]> | 2023-11-14 10:24:42 +0800 |
| commit | f5ce08825a72a3636df3f3d7d30d9ce73c5b421d (patch) | |
| tree | 21486fa02597abf22be7879cda1f2043608405e7 | |
| parent | c9672ec5a7e182da686d1c596cd5eac47582aedc (diff) | |
发包功能完善
| -rw-r--r-- | go.mod | 1 | ||||
| -rw-r--r-- | go.sum | 2 | ||||
| -rw-r--r-- | main.go | 9 |
3 files changed, 7 insertions, 5 deletions
@@ -6,6 +6,7 @@ require ( github.com/miekg/dns v1.1.55 github.com/panjf2000/ants/v2 v2.8.2 github.com/schollz/progressbar/v3 v3.13.1 + github.com/thanhpk/randstr v1.0.6 ) require ( @@ -25,6 +25,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/thanhpk/randstr v1.0.6 h1:psAOktJFD4vV9NEVb3qkhRSMvYh4ORRaj1+w/hn4B+o= +github.com/thanhpk/randstr v1.0.6/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= @@ -1,13 +1,10 @@ package main import ( - "bufio" - "encoding/csv" "github.com/miekg/dns" "github.com/panjf2000/ants/v2" "github.com/schollz/progressbar/v3" - "io" - "log" + "github.com/thanhpk/randstr" "os" "strconv" "strings" @@ -20,12 +17,13 @@ func main() { var wg sync.WaitGroup - p, _ := ants.NewPool(100, ants.WithPreAlloc(true)) + p, _ := ants.NewPool(500, ants.WithPreAlloc(true)) c := new(dns.Client) args := os.Args qname := args[1] runcount, _ := strconv.Atoi(args[2]) + bar := progressbar.Default(int64(runcount*len(args[3:])), "发包进度") for i := runcount; i > 0; i-- { for _, v := range args[3:] { wg.Add(1) @@ -45,6 +43,7 @@ func main() { return } }) + bar.Add(1) } } wg.Wait() |
