debug

package
v1.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

debug

Name

debug - disables the automatic recovery upon a crash so that you'll get a nice stack trace.

Description

Normally CoreDNS will recover from panics; using debug inhibits this. The main use of debug is to help in testing. A side effect of using debug is that log.Debug and log.Debugf messages will be printed to standard output.

Note that the errors plugin (if loaded) will also set a recover, negating this setting.

Enabling this plugin is process-wide: enabling debug in at least one server block enables debug mode globally.

Syntax

debug

Some plugins will send debug log DNS messages. This is done in the following format:

debug: 000000 00 0a 01 00 00 01 00 00 00 00 00 01 07 65 78 61
debug: 000010 6d 70 6c 65 05 6c 6f 63 61 6c 00 00 01 00 01 00
debug: 000020 00 29 10 00 00 00 80 00 00 00
debug: 00002a

Using text2pcap (part of Wireshark), this can be converted back to binary, with the following command line: text2pcap -i 17 -u 53,53, where 17 is the protocol (UDP) and 53 are the ports. These ports allow Wireshark to detect these packets as DNS messages.

Each plugin can decide whether to dump messages to aid in debugging.

Examples

Disable the ability to recover from crashes and show debug logging:

. {
    debug
}

See Also

https://www.wireshark.org/docs/man-pages/text2pcap.html.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hexdump

func Hexdump(m *dns.Msg, v ...interface{})

Hexdump converts the dns message m to a hex dump Wireshark can import. See https://www.wireshark.org/docs/man-pages/text2pcap.html. This output looks like this:

00000 dc bd 01 00 00 01 00 00 00 00 00 01 07 65 78 61 000010 6d 70 6c 65 05 6c 6f 63 61 6c 00 00 01 00 01 00 000020 00 29 10 00 00 00 80 00 00 00 00002a

Hexdump will use log.Debug to write the dump to the log, each line is prefixed with 'debug: ' so the data can be easily extracted.

msg will prefix the pcap dump.

Example
buf, _ := msg().Pack()
h := hexdump(buf)
fmt.Println(string(h))
Output:

debug: 000000 00 0a 01 00 00 01 00 00 00 00 00 01 07 65 78 61
debug: 000010 6d 70 6c 65 05 6c 6f 63 61 6c 00 00 01 00 01 00
debug: 000020 00 29 10 00 00 00 80 00 00 00
debug: 00002a

func Hexdumpf

func Hexdumpf(m *dns.Msg, format string, v ...interface{})

Hexdumpf dumps a DNS message as Hexdump, but allows a format string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL