Documentation
¶
Index ¶
- Variables
- func CheckWildcard(ctx context.Context, domain string, timeout time.Duration, dnsServer string) (bool, error)
- func ParseTypes(s string) ([]string, error)
- func ResolveDomain(ctx context.Context, domain string, timeout time.Duration, dnsServer string, ...) bool
- func SimulateResolution(domain string, hitRate int, verbose bool) bool
- type Record
- func Resolve(ctx context.Context, domain string, timeout time.Duration, dnsServer string) ([]Record, time.Duration, error)
- func ResolveDomainWithRetry(ctx context.Context, domain string, timeout time.Duration, dnsServer string, ...) ([]Record, bool)
- func ResolveTypes(ctx context.Context, domain string, timeout time.Duration, dnsServer string, ...) ([]Record, time.Duration, error)
- func ResolveWithLog(ctx context.Context, domain string, timeout time.Duration, dnsServer string, ...) ([]Record, time.Duration, error)
- func SimulateResolve(domain string, hitRate int, verbose bool, types []string) ([]Record, bool)
Constants ¶
This section is empty.
Variables ¶
var DefaultTypes = []string{"A", "AAAA"}
DefaultTypes is the record-type set used when none is specified; it preserves the historical LookupHost behavior (A and AAAA).
Functions ¶
func CheckWildcard ¶
func CheckWildcard(ctx context.Context, domain string, timeout time.Duration, dnsServer string) (bool, error)
CheckWildcard probes the domain with two random subdomains. If both resolve the domain almost certainly uses wildcard DNS. Returns (isWildcard, error).
func ParseTypes ¶ added in v0.6.0
ParseTypes parses a comma-separated record-type list (for example "A,AAAA,CNAME") into a normalized, de-duplicated, uppercase slice.
Types ¶
type Record ¶ added in v0.6.0
Record is a single resolved DNS record. Type is "A", "AAAA", "CNAME", etc. Value is the IP address (for A/AAAA) or target name (for CNAME).
func Resolve ¶ added in v0.6.0
func Resolve(ctx context.Context, domain string, timeout time.Duration, dnsServer string) ([]Record, time.Duration, error)
Resolve performs a single host lookup and returns the resolved records (A and AAAA), the elapsed time, and any error. It performs no logging.
func ResolveDomainWithRetry ¶
func ResolveDomainWithRetry(ctx context.Context, domain string, timeout time.Duration, dnsServer string, verbose bool, maxAttempts int, types []string) ([]Record, bool)
ResolveDomainWithRetry calls ResolveWithLog up to maxAttempts times, respecting ctx cancellation between attempts with a linear backoff delay. It returns the resolved records and whether resolution succeeded.
func ResolveTypes ¶ added in v0.6.0
func ResolveTypes(ctx context.Context, domain string, timeout time.Duration, dnsServer string, types []string) ([]Record, time.Duration, error)
ResolveTypes performs per-type DNS lookups for the requested record types and returns the matching records, the elapsed time, and the last lookup error (if any). An empty types slice falls back to DefaultTypes.
func ResolveWithLog ¶ added in v0.6.0
func ResolveWithLog(ctx context.Context, domain string, timeout time.Duration, dnsServer string, verbose bool, types []string) ([]Record, time.Duration, error)
ResolveWithLog wraps ResolveTypes with the verbose stderr logging used by the CLI and TUI, returning the resolved records for the requested types.