diff --git a/dnsutils/dnsmessage.go b/dnsutils/dnsmessage.go index d75a7c3a..d1993399 100644 --- a/dnsutils/dnsmessage.go +++ b/dnsutils/dnsmessage.go @@ -126,7 +126,7 @@ type PowerDNS struct { InitialRequestorID string `json:"initial-requestor-id"` RequestorID string `json:"requestor-id"` DeviceName string `json:"device-name"` - DeviceId string `json:"device-id"` + DeviceID string `json:"device-id"` } type TransformDNSGeo struct { diff --git a/dnsutils/dnsmessage_json.go b/dnsutils/dnsmessage_json.go index 0d848ff9..90e3d01f 100644 --- a/dnsutils/dnsmessage_json.go +++ b/dnsutils/dnsmessage_json.go @@ -217,7 +217,7 @@ func (dm *DNSMessage) Flatten() (map[string]interface{}, error) { dnsFields["powerdns.http-version"] = dm.PowerDNS.HTTPVersion dnsFields["powerdns.message-id"] = dm.PowerDNS.MessageID dnsFields["powerdns.requestor-id"] = dm.PowerDNS.RequestorID - dnsFields["powerdns.device-id"] = dm.PowerDNS.DeviceId + dnsFields["powerdns.device-id"] = dm.PowerDNS.DeviceID dnsFields["powerdns.device-name"] = dm.PowerDNS.DeviceName dnsFields["powerdns.initial-requestor-id"] = dm.PowerDNS.InitialRequestorID } diff --git a/dnsutils/dnsmessage_json_test.go b/dnsutils/dnsmessage_json_test.go index e37576c6..7c4e32fd 100644 --- a/dnsutils/dnsmessage_json_test.go +++ b/dnsutils/dnsmessage_json_test.go @@ -114,7 +114,7 @@ func TestDnsMessage_Json_Collectors_Reference(t *testing.T) { MessageID: "27c3e94ad6284eec9a50cfc5bd7384d6", InitialRequestorID: "5e006236c8a74f7eafc6af126e6d0689", RequestorID: "f7c3e94ad6284eec9a50cfc5bd7384d6", - DeviceId: "ffffffffffffffffeaaeaeae", + DeviceID: "ffffffffffffffffeaaeaeae", DeviceName: "foobar", }}, diff --git a/dnsutils/dnsmessage_text.go b/dnsutils/dnsmessage_text.go index 347ce1d7..75d4323c 100644 --- a/dnsutils/dnsmessage_text.go +++ b/dnsutils/dnsmessage_text.go @@ -109,8 +109,8 @@ func (dm *DNSMessage) handlePdnsDirectives(directive string, s *strings.Builder) s.WriteString("-") } case directive == "powerdns-device-id": - if len(dm.PowerDNS.DeviceId) > 0 { - s.WriteString(dm.PowerDNS.DeviceId) + if len(dm.PowerDNS.DeviceID) > 0 { + s.WriteString(dm.PowerDNS.DeviceID) } else { s.WriteString("-") } diff --git a/dnsutils/dnsmessage_text_test.go b/dnsutils/dnsmessage_text_test.go index 8f77d43d..138cbd75 100644 --- a/dnsutils/dnsmessage_text_test.go +++ b/dnsutils/dnsmessage_text_test.go @@ -491,7 +491,7 @@ func TestDnsMessage_TextFormat_Directives_Pdns(t *testing.T) { { name: "device_id_name", format: "powerdns-device-id powerdns-device-name", - dm: DNSMessage{PowerDNS: &PowerDNS{DeviceId: "5e006236c8a74f7eafc6af126e6d0689", DeviceName: "test"}}, + dm: DNSMessage{PowerDNS: &PowerDNS{DeviceID: "5e006236c8a74f7eafc6af126e6d0689", DeviceName: "test"}}, expected: "5e006236c8a74f7eafc6af126e6d0689 test", }, }