feat: Trace #162
1 changed files with 8 additions and 8 deletions
16
main.go
16
main.go
|
@ -91,12 +91,12 @@ func run(args []string) (opts *util.Options, code int, err error) {
|
|||
fmt.Println(str)
|
||||
|
||||
if keepTracing {
|
||||
var nothing []dns.RR
|
||||
var records []dns.RR
|
||||
|
||||
if opts.Request.Name == "." {
|
||||
nothing = resp.DNS.Answer
|
||||
records = resp.DNS.Answer
|
||||
} else {
|
||||
nothing = resp.DNS.Ns
|
||||
records = resp.DNS.Ns
|
||||
}
|
||||
|
||||
want := func(rr dns.RR) bool {
|
||||
|
@ -107,17 +107,17 @@ func run(args []string) (opts *util.Options, code int, err error) {
|
|||
|
||||
i := 0
|
||||
|
||||
for _, x := range nothing {
|
||||
for _, x := range records {
|
||||
if want(x) {
|
||||
nothing[i] = x
|
||||
records[i] = x
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
nothing = nothing[:i]
|
||||
nothing2 := nothing[r.Intn(len(nothing))]
|
||||
records = records[:i]
|
||||
randomRR := records[r.Intn(len(records))]
|
||||
|
||||
v := strings.Split(nothing2.String(), "\t")
|
||||
v := strings.Split(randomRR.String(), "\t")
|
||||
opts.Request.Server = strings.TrimSuffix(v[len(v)-1], ".")
|
||||
|
||||
opts.TLS = false
|
||||
|
|
Loading…
Reference in a new issue