Skip to content

Commit

Permalink
Add support for DoT to DNS probes
Browse files Browse the repository at this point in the history
Signed-off-by: André Cruz <[email protected]>
  • Loading branch information
edevil committed Jun 17, 2020
1 parent 3007522 commit 0210007
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ type ICMPProbe struct {
type DNSProbe struct {
IPProtocol string `yaml:"preferred_ip_protocol,omitempty"`
IPProtocolFallback bool `yaml:"ip_protocol_fallback,omitempty"`
DNSOverTLS bool `yaml:"dns_over_tls,omitempty"`
SourceIPAddress string `yaml:"source_ip_address,omitempty"`
TransportProtocol string `yaml:"transport_protocol,omitempty"`
QueryClass string `yaml:"query_class,omitempty"` // Defaults to IN.
Expand Down
9 changes: 9 additions & 0 deletions prober/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
dialProtocol = module.DNS.TransportProtocol + "4"
}

if module.DNS.DNSOverTLS {
if module.DNS.TransportProtocol == "tcp" {
dialProtocol += "-tls"
} else {
level.Error(logger).Log("msg", "Configuration error: Expected transport protocol tcp for DoT", "protocol", module.DNS.TransportProtocol)
return false
}
}

client := new(dns.Client)
client.Net = dialProtocol

Expand Down

0 comments on commit 0210007

Please sign in to comment.