Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterPrivateAddresses ¶
func FilterPrivateAddresses(answers []dns.ResourceRecord) []dns.ResourceRecord
FilterPrivateAddresses removes A/AAAA records that contain private, loopback, or link-local addresses. This prevents DNS rebinding attacks where an external domain resolves to an internal IP.
func SanitizeBailiwick ¶
SanitizeBailiwick removes records from a DNS response that are outside the authority of the responding nameserver's zone.
Types ¶
type ACL ¶
type ACL struct {
// contains filtered or unexported fields
}
ACL implements access control list based on CIDR ranges, with optional per-zone overrides.
func (*ACL) AddZoneACL ¶
func (acl *ACL) AddZoneACL(cfg ZoneACLConfig) error
AddZoneACL adds a per-zone access control rule. Zone-specific rules are checked before global rules when using CheckWithZone.
func (*ACL) CheckWithZone ¶
CheckWithZone returns true if the IP is allowed for queries to the given qname. It first looks for a matching zone-specific rule. If one is found, only that zone's allow/deny lists are evaluated. If no zone matches, the global rules are used.
type RRL ¶
type RRL struct {
// contains filtered or unexported fields
}
RRL implements Response Rate Limiting to prevent DNS amplification attacks.
func (*RRL) AllowResponse ¶
AllowResponse checks if a response should be allowed, dropped, or slipped.
func (*RRL) StartCleanup ¶
func (r *RRL) StartCleanup(ctx interface{ Done() <-chan struct{} })
StartCleanup removes stale RRL entries periodically.
type RRLAction ¶
type RRLAction int
RRLAction represents the action to take for a rate-limited response.
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements per-IP token bucket rate limiting.
func NewRateLimiter ¶
func NewRateLimiter(rate float64, burst int) *RateLimiter
NewRateLimiter creates a new per-IP rate limiter.
func (*RateLimiter) Allow ¶
func (rl *RateLimiter) Allow(clientIP string) bool
Allow checks if a request from clientIP should be allowed.
func (*RateLimiter) StartCleanup ¶
func (rl *RateLimiter) StartCleanup(ctx context.Context)
StartCleanup removes idle clients periodically.
type ZoneACL ¶
ZoneACL defines access control rules scoped to a specific DNS zone. When a query matches a zone, these rules are evaluated instead of the global allow/deny lists.
type ZoneACLConfig ¶
ZoneACLConfig is the configuration input for a per-zone ACL rule.