From 3aec38d592b85e38ce3d642eaa2337b0675db443 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 21 Jun 2021 13:00:17 -0400 Subject: [PATCH] contrib: add some docs for the DNS interface --- contributing/README.md | 1 + contributing/service-discovery/README.md | 5 +++++ contributing/service-discovery/dns.md | 28 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 contributing/service-discovery/README.md create mode 100644 contributing/service-discovery/dns.md diff --git a/contributing/README.md b/contributing/README.md index 0c61758d8f..d84e41824d 100644 --- a/contributing/README.md +++ b/contributing/README.md @@ -11,3 +11,4 @@ understanding, and contributing changes to, the Consul codebase. 2. [Configuration](./checklist-adding-config-fields.md) 3. [Streaming](./streaming) 4. [Network Areas](./network-areas) +5. [Service Discovery](./service-discovery) diff --git a/contributing/service-discovery/README.md b/contributing/service-discovery/README.md new file mode 100644 index 0000000000..50e8e2c0b0 --- /dev/null +++ b/contributing/service-discovery/README.md @@ -0,0 +1,5 @@ +# Service Discovery + +This section is still a work in progress. + +1. [DNS Interface](./dns.md) diff --git a/contributing/service-discovery/dns.md b/contributing/service-discovery/dns.md new file mode 100644 index 0000000000..599b9f2eea --- /dev/null +++ b/contributing/service-discovery/dns.md @@ -0,0 +1,28 @@ +# DNS Interface + +The DNS interface allows users to find the IP address and port of services, using DNS +queries. The DNS interface is in many ways similar to an HTTP API. The major difference is +in the DNS protocol. + +There are lots of guides to DNS, the following list is a short reference that should help you +understand the parts that are relevant to the DNS interface in Consul. Full details about +the DNS protocol can be found in the RFCs: [RFC 1035], [RFC 6891], [RFC 2782], and others. + +[RFC 1035]: https://tools.ietf.org/html/rfc1035 +[RFC 6891]: https://tools.ietf.org/html/rfc6891 +[RFC 2782]: https://tools.ietf.org/html/rfc2782 + +* [wikipedia: DNS message format](https://en.wikipedia.org/wiki/Domain_Name_System#DNS_message_format) + is a quick introduction to the format used for queries and replies +* [RFC 1035 Section 4.1.1](https://datatracker.ietf.org/doc/html/rfc1035#section-4.1.1) + is a good reference for when to use specific response codes and what the different header + bits refer to. + + +## DNS Server + +The DNS interface is implemented as a DNS server using [miekg/dns] and the handlers for +requests are in `agent/dns.go`. + + +[miekg/dns]: https://github.com/miekg/dns