check / check (push) Canceled after 0s
LookupNS now follows the delegation for the domain alone. When the parent zone's servers answer that it has no delegation, as for a domain that does not exist, the set is empty, and the watcher's NS comparison reports every nameserver removed. FindAuthoritativeNameservers, used for hostnames, still moves to a parent name when the servers answer that the name has no delegation of its own, but returns the error when they do not answer, where it used to take a parent zone's nameservers. The fallback walk treats an authoritative answer the same way. A domain with no delegation still has its own records asked at the servers of the zone it is in. Model: opus-5-5
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
// Package watcher provides the main monitoring orchestrator.
|
|
package watcher
|
|
|
|
import (
|
|
"context"
|
|
|
|
"sneak.berlin/go/dnswatcher/internal/portcheck"
|
|
"sneak.berlin/go/dnswatcher/internal/resolver"
|
|
"sneak.berlin/go/dnswatcher/internal/tlscheck"
|
|
)
|
|
|
|
// DNSResolver performs iterative DNS resolution.
|
|
type DNSResolver interface {
|
|
// LookupNS returns a domain's NS record set, as its parent zone's
|
|
// servers delegate it: empty when they answer that it has none.
|
|
LookupNS(
|
|
ctx context.Context,
|
|
domain string,
|
|
) ([]string, error)
|
|
|
|
// LookupAllRecords queries all record types for a hostname,
|
|
// returning each nameserver's response keyed by nameserver.
|
|
LookupAllRecords(
|
|
ctx context.Context,
|
|
hostname string,
|
|
) (map[string]*resolver.NameserverResponse, error)
|
|
|
|
// ResolveIPAddresses resolves a hostname to all IP addresses.
|
|
ResolveIPAddresses(
|
|
ctx context.Context,
|
|
hostname string,
|
|
) ([]string, error)
|
|
}
|
|
|
|
// PortChecker tests TCP port connectivity.
|
|
type PortChecker interface {
|
|
// CheckPort tests TCP connectivity to an address and port.
|
|
CheckPort(
|
|
ctx context.Context,
|
|
address string,
|
|
port int,
|
|
) (*portcheck.PortResult, error)
|
|
}
|
|
|
|
// TLSChecker inspects TLS certificates.
|
|
type TLSChecker interface {
|
|
// CheckCertificate connects via TLS and returns cert info.
|
|
CheckCertificate(
|
|
ctx context.Context,
|
|
ip string,
|
|
hostname string,
|
|
) (*tlscheck.CertificateInfo, error)
|
|
}
|
|
|
|
// Notifier delivers notifications to configured endpoints.
|
|
type Notifier interface {
|
|
// SendNotification sends a notification with the given
|
|
// details.
|
|
SendNotification(
|
|
ctx context.Context,
|
|
title, message, priority string,
|
|
)
|
|
}
|