Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
update README.md
  • Loading branch information
dmachard committed Sep 30, 2024
1 parent 3275d21 commit 40b78e0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<p align="center">
<img src="https://goreportcard.com/badge/github.com/dmachard/go-dns-collector" alt="Go Report"/>
<img src="https://img.shields.io/badge/go%20version-min%201.21-green" alt="Go version"/>
<img src="https://img.shields.io/badge/go%20tests-501-green" alt="Go tests"/>
<img src="https://img.shields.io/badge/go%20tests-505-green" alt="Go tests"/>
<img src="https://img.shields.io/badge/go%20bench-21-green" alt="Go bench"/>
<img src="https://img.shields.io/badge/go%20lines-31528-green" alt="Go lines"/>
<img src="https://img.shields.io/badge/go%20lines-31634-green" alt="Go lines"/>
</p>

<p align="center">
Expand Down
2 changes: 1 addition & 1 deletion dnsutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func GetFakeDNS() ([]byte, error) {
return dnsmsg.Pack()
}

func GetDnsResponsePacket() ([]byte, error) {
func GetDNSResponsePacket() ([]byte, error) {
dnsmsg := new(dns.Msg)
dnsmsg.SetQuestion("dns.collector.", dns.TypeA)

Expand Down
13 changes: 5 additions & 8 deletions workers/dnsprocessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/dmachard/go-dnscollector/dnsutils"
"github.com/dmachard/go-dnscollector/pkgconfig"
"github.com/dmachard/go-logger"
"github.com/dmachard/go-netutils"
)

func Test_DnsProcessor(t *testing.T) {
Expand Down Expand Up @@ -50,12 +49,10 @@ func Test_DnsProcessor_DecodeCounters(t *testing.T) {
go consumer.StartCollect()

// get dns packet
responsePacket, _ := dnsutils.GetDnsResponsePacket()
responsePacket, _ := dnsutils.GetDNSResponsePacket()

// prepare dns message
dm := dnsutils.GetFakeDNSMessage()
dm.NetworkInfo.Family = netutils.ProtoIPv4
dm.NetworkInfo.Protocol = netutils.ProtoUDP
dm.DNS.Payload = responsePacket
dm.DNS.Length = len(responsePacket)

Expand All @@ -65,16 +62,16 @@ func Test_DnsProcessor_DecodeCounters(t *testing.T) {
// read dns message from dnstap consumer
dmOut := <-fl.GetInputChannel()
if dmOut.DNS.QdCount != 1 {
t.Errorf("invalid number of questions in dns message: %d", dmOut.DNS.QdCount)
t.Errorf("invalid number of questions in dns message: got %d expect 1", dmOut.DNS.QdCount)
}
if dmOut.DNS.NsCount != 1 {
t.Errorf("invalid number of nscount in dns message: %d", dmOut.DNS.NsCount)
t.Errorf("invalid number of nscount in dns message: got %d expect 1", dmOut.DNS.NsCount)
}
if dmOut.DNS.AnCount != 1 {
t.Errorf("invalid number of ancount in dns message: %d", dmOut.DNS.AnCount)
t.Errorf("invalid number of ancount in dns message: got %d expect 1", dmOut.DNS.AnCount)
}
if dmOut.DNS.ArCount != 1 {
t.Errorf("invalid number of arcount in dns message: %d", dmOut.DNS.ArCount)
t.Errorf("invalid number of arcount in dns message: got %d expect 1", dmOut.DNS.ArCount)
}
}

Expand Down
10 changes: 5 additions & 5 deletions workers/dnstapserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func Test_DnstapProcessor_DecodeCounters(t *testing.T) {
consumer.AddDroppedRoute(fl)

// get dns packet
responsePacket, _ := dnsutils.GetDnsResponsePacket()
responsePacket, _ := dnsutils.GetDNSResponsePacket()

// prepare dnstap
dt := &dnstap.Dnstap{}
Expand All @@ -274,16 +274,16 @@ func Test_DnstapProcessor_DecodeCounters(t *testing.T) {
// read dns message from dnstap consumer
dm := <-fl.GetInputChannel()
if dm.DNS.QdCount != 1 {
t.Errorf("invalid number of questions in dns message: %d", dm.DNS.QdCount)
t.Errorf("invalid number of questions in dns message: got %d expect 1", dm.DNS.QdCount)
}
if dm.DNS.NsCount != 1 {
t.Errorf("invalid number of nscount in dns message: %d", dm.DNS.NsCount)
t.Errorf("invalid number of nscount in dns message: got %d expect 1", dm.DNS.NsCount)
}
if dm.DNS.AnCount != 1 {
t.Errorf("invalid number of ancount in dns message: %d", dm.DNS.AnCount)
t.Errorf("invalid number of ancount in dns message: got %d expect 1", dm.DNS.AnCount)
}
if dm.DNS.ArCount != 1 {
t.Errorf("invalid number of arcount in dns message: %d", dm.DNS.ArCount)
t.Errorf("invalid number of arcount in dns message: got %d expect 1", dm.DNS.ArCount)
}
}

Expand Down

0 comments on commit 40b78e0

Please sign in to comment.