rbmk

DNS data format

   
Author @bassosimone
Last-Updated 2025-07-03

This document describes the format of DNS measurements emitted by rbmk.

Table of contents

Overview

The dnscore package emits a “query” event before sending a DNS query and one or more “response” events when receiving responses. In general, we expect a single “response” per query. However, when using DNS over UDP, we may receive multiple responses for a single query, due to network misconfiguration or internet censorship.

Specifically, the Great Firewall of China (GFW) may cause multiple responses for the same query, with the last response typically being the legitimate response from the server, and previous responses being fake and for arbitrary addresses.

Address and Protocol

A remote server is identified by an address and a protocol.

The protocol is an enumeration string with the following values:

For "udp", "tcp", "dot", and "doq" the address is a string containing an IP address and a port separated by ":". When the address is and IPv6 address, it is enclosed in square brackets. The following are valid addresses:

For "doh", the address is a string containing the URL of the server. The following are valid addresses:

Query

The JSON serialization of the query message contains at least the following fields:

{
  "msg":"dnsQuery",
  "dnsRawQuery":"",
  "serverAddr":"",
  "serverProtocol":"",
  "t":"",
  "protocol": ""
}

Where:

The current dnscore implementation uses log/slog, which causes the generated message to contain additional fields that you can safely ignore when processing the message.

Response

The JSON serialization of the response message contains at least the following fields:

{
  "msg":"dnsResponse",
  "localAddr": "",
  "dnsRawQuery":"",
  "dnsRawResponse":"",
  "remoteAddr": "",
  "serverAddr":"",
  "serverProtocol":"",
  "t0":"",
  "t":"",
  "protocol": ""
}

Where:

The current dnscore implementation uses log/slog, which causes the generated message to contain additional fields that you can safely ignore when processing the message.

Example

Here is an example of a "dnsQuery" message:

{
  "msg":"dnsQuery",
  "dnsRawQuery":"yHUBAAABAAAAAAABA3d3dwdleGFtcGxlA2NvbQAAAQABAAApBNAAAAAAAAA=",
  "serverAddr":"8.8.8.8:53",
  "serverProtocol":"udp",
  "t":"2024-11-18T15:31:53.05491+01:00",
  "protocol": "udp"
}

Here is an example of a "dnsResponse" message:

{
  "msg":"dnsResponse",
  "localAddr": "130.192.91.211:32769",
  "dnsRawQuery":"yHUBAAABAAAAAAABA3d3dwdleGFtcGxlA2NvbQAAAQABAAApBNAAAAAAAAA=",
  "dnsRawResponse":"yHWBgAABAAEAAAABA3d3dwdleGFtcGxlA2NvbQAAAQABwAwAAQABAAANVAAEXbjXDgAAKQIAAAAAAAAA",
  "remoteAddr": "8.8.8.8:53",
  "serverAddr":"8.8.8.8:53",
  "serverProtocol":"udp",
  "t0":"2024-11-18T15:31:53.05491+01:00",
  "t":"2024-11-18T15:31:53.072107+01:00",
  "protocol": "udp"
}