summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHandingkang <[email protected]>2023-11-14 11:29:45 +0800
committerHandingkang <[email protected]>2023-11-14 11:29:45 +0800
commit190aef03a44a099633cfb85e34a4f664b7fa77bf (patch)
treefd6d4d010f8d1776da57f4c5b7d0e2281ce41bbe
parent16ebea2e8e60093f9ce44e54c817b05a0486d752 (diff)
随机算法库更新
-rw-r--r--go.mod1
-rw-r--r--go.sum2
-rw-r--r--plugin/atk/atk.go6
3 files changed, 6 insertions, 3 deletions
diff --git a/go.mod b/go.mod
index a54ec01..e2f7562 100644
--- a/go.mod
+++ b/go.mod
@@ -13,6 +13,7 @@ require (
github.com/panjf2000/ants/v2 v2.8.1
github.com/pochard/commons v1.1.2
github.com/prometheus/client_golang v1.15.1
+ github.com/thanhpk/randstr v1.0.6
golang.org/x/sys v0.10.0
google.golang.org/grpc v1.55.0
google.golang.org/protobuf v1.30.0
diff --git a/go.sum b/go.sum
index 15c3b15..ef85dfa 100644
--- a/go.sum
+++ b/go.sum
@@ -62,6 +62,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.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
diff --git a/plugin/atk/atk.go b/plugin/atk/atk.go
index f7031f0..b5b6ccb 100644
--- a/plugin/atk/atk.go
+++ b/plugin/atk/atk.go
@@ -3,7 +3,7 @@ package atk
import (
"context"
"github.com/miekg/dns"
- "github.com/pochard/commons/randstr"
+ "github.com/thanhpk/randstr"
"net"
"ohmydns2/plugin/pkg/proxy"
"ohmydns2/plugin/pkg/request"
@@ -82,7 +82,7 @@ func (a Atk) Response(msg *dns.Msg, iptype int) *dns.Msg {
rec := new(dns.NS)
rec.Hdr = dns.RR_Header{Class: dns.ClassINET, Ttl: 10, Rrtype: dns.TypeNS}
rec.Hdr.Name = msg.Question[0].Name
- ns := strings.ToLower(randstr.RandomAlphanumeric(10)) + "." + a.zoneip6
+ ns := strings.ToLower(randstr.String(10)) + "." + a.zoneip6
log.Infof("生成NS: %v", ns)
rec.Ns = ns
msg.Ns = append(msg.Ns, rec)
@@ -92,7 +92,7 @@ func (a Atk) Response(msg *dns.Msg, iptype int) *dns.Msg {
rec := new(dns.NS)
rec.Hdr = dns.RR_Header{Class: dns.ClassINET, Ttl: 10, Rrtype: dns.TypeNS}
rec.Hdr.Name = msg.Question[0].Name
- ns := strings.ToLower(randstr.RandomAlphanumeric(10)) + "." + a.zoneip4
+ ns := strings.ToLower(randstr.String(10)) + "." + a.zoneip4
log.Infof("生成NS: %v", ns)
rec.Ns = ns
msg.Ns = append(msg.Ns, rec)