Review changes

This commit is contained in:
cemturker 2020-11-19 09:31:30 +01:00
parent 1fb2635226
commit 8789a4ad55
3 changed files with 6 additions and 6 deletions

View File

@ -22,10 +22,10 @@ const (
// Values that could replace the placeholder: 127.0.0.1, 10.0.0.1, ... // Values that could replace the placeholder: 127.0.0.1, 10.0.0.1, ...
IPPlaceholder = "[IP]" IPPlaceholder = "[IP]"
// DNSRCodePlaceHolder is a place holder for DNS_RCODE // DNSRCodePlaceholder is a place holder for DNS_RCODE
// //
// Values that could be NOERROR, FORMERR, SERVFAIL, NXDOMAIN, NOTIMP and REFUSED // Values that could be NOERROR, FORMERR, SERVFAIL, NXDOMAIN, NOTIMP and REFUSED
DNSRCodePlaceHolder = "[DNS_RCODE]" DNSRCodePlaceholder = "[DNS_RCODE]"
// ResponseTimePlaceholder is a placeholder for the request response time, in milliseconds. // ResponseTimePlaceholder is a placeholder for the request response time, in milliseconds.
// //
@ -152,7 +152,7 @@ func sanitizeAndResolve(list []string, result *Result) []string {
element = strconv.Itoa(int(result.Duration.Milliseconds())) element = strconv.Itoa(int(result.Duration.Milliseconds()))
case BodyPlaceholder: case BodyPlaceholder:
element = body element = body
case DNSRCodePlaceHolder: case DNSRCodePlaceholder:
element = result.DNSRCode element = result.DNSRCode
case ConnectedPlaceholder: case ConnectedPlaceholder:
element = strconv.FormatBool(result.Connected) element = strconv.FormatBool(result.Connected)

View File

@ -84,7 +84,7 @@ func TestIntegrationQuery(t *testing.T) {
t.Errorf("there should be errors") t.Errorf("there should be errors")
} }
if result.DNSRCode != test.expectedDNSCode { if result.DNSRCode != test.expectedDNSCode {
t.Errorf("DNSRCodePlaceHolder '%s' should have been %s", result.DNSRCode, test.expectedDNSCode) t.Errorf("DNSRCodePlaceholder '%s' should have been %s", result.DNSRCode, test.expectedDNSCode)
} }
if string(result.Body) != test.expectedBody { if string(result.Body) != test.expectedBody {

View File

@ -19,8 +19,8 @@ type Result struct {
// HTTPStatus is the HTTP response status code // HTTPStatus is the HTTP response status code
HTTPStatus int `json:"status"` HTTPStatus int `json:"status"`
// // DNSRCode is the response code of DNS query in human readable version
DNSRCode string `json:"dnsr_code"` DNSRCode string `json:"dns-rcode"`
// Body is the response body // Body is the response body
Body []byte `json:"-"` Body []byte `json:"-"`