summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author韩丁康 <[email protected]>2023-11-14 10:24:42 +0800
committer韩丁康 <[email protected]>2023-11-14 10:24:42 +0800
commitf5ce08825a72a3636df3f3d7d30d9ce73c5b421d (patch)
tree21486fa02597abf22be7879cda1f2043608405e7
parentc9672ec5a7e182da686d1c596cd5eac47582aedc (diff)
发包功能完善
-rw-r--r--go.mod1
-rw-r--r--go.sum2
-rw-r--r--main.go9
3 files changed, 7 insertions, 5 deletions
diff --git a/go.mod b/go.mod
index c21aafe..e0c53cc 100644
--- a/go.mod
+++ b/go.mod
@@ -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 (
diff --git a/go.sum b/go.sum
index 6e444d7..341b6e3 100644
--- a/go.sum
+++ b/go.sum
@@ -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=
diff --git a/main.go b/main.go
index ea5ec2e..1df041b 100644
--- a/main.go
+++ b/main.go
@@ -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()