A command-line tool and Go library to fetch DNS CAA (Certification Authority Authorization) records for a hostname.
go install github.com/weppos/digcaa/cmd/digcaa@latestor build from source:
git clone https://github.com/weppos/digcaa.git
cd digcaa
make buildThe binary will be created in the current directory as digcaa.
digcaa <hostname>Lookup CAA records for a domain:
digcaa www.dnsimple.com
# 10 records found
# www.dnsimple.com : dnsimple.com. 3600 IN CAA 0 issue "amazon.com"
# www.dnsimple.com : dnsimple.com. 3600 IN CAA 0 issue "letsencrypt.org"
# www.dnsimple.com : dnsimple.com. 3600 IN CAA 0 issuewild "sectigo.com"
# www.dnsimple.com : dnsimple.com. 3600 IN CAA 0 iodef "mailto:ops@dnsimple.com"
# [...]Configure DNS query timeout and resolver:
# Use a 10 second timeout
digcaa --timeout 10s example.com
# Use a 10 millisecond timeout
digcaa --timeout 10ms example.com
# Use a 1 minute timeout
digcaa --timeout 1m example.com
# Use Cloudflare DNS resolver
digcaa --resolver 1.1.1.1:53 example.com
# Combine timeout and resolver
digcaa --timeout 10s --resolver 1.1.1.1:53 example.comInstall the library:
go get github.com/weppos/digcaaUse it in your Go code:
package main
import (
"fmt"
"log"
"github.com/weppos/digcaa"
)
func main() {
// Use default resolver and timeout
records, err := digcaa.Lookup("www.comodo.com")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d records found\n", len(records))
for _, record := range records {
fmt.Println(record)
}
}Use custom timeout and resolver:
package main
import (
"fmt"
"log"
"time"
"github.com/weppos/digcaa"
)
func main() {
// Create a custom configuration
config := &digcaa.Config{
Timeout: 10 * time.Second,
Resolver: "1.1.1.1:53", // Cloudflare DNS
}
resolver := digcaa.NewResolverWithConfig(config)
records, err := resolver.Lookup("www.example.com")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d records found\n", len(records))
for _, record := range records {
fmt.Println(record)
}
}