Versions in this module Expand all Collapse all v0 v0.0.2 Oct 1, 2023 v0.0.1 Sep 30, 2023 Changes in this version + const BlockedSvcsListID + const CustomListID + const ParentalListID + const SafeBrowsingListID + const SafeSearchListID + const SysHostsListID + func InitModule() + func ValidateUpdateIvl(i uint32) bool + type BlockedServices struct + IDs []string + Schedule *schedule.Weekly + func (s *BlockedServices) Clone() (c *BlockedServices) + func (s *BlockedServices) Validate() (err error) + type BlockingMode string + const BlockingModeCustomIP + const BlockingModeDefault + const BlockingModeNXDOMAIN + const BlockingModeNullIP + const BlockingModeREFUSED + type Checker interface + Check func(host string) (block bool, err error) + type Config struct + BlockedResponseTTL uint32 + BlockedServices *BlockedServices + BlockingIPv4 netip.Addr + BlockingIPv6 netip.Addr + BlockingMode BlockingMode + CacheTime uint + ConfigModified func() + DataDir string + EtcHosts *aghnet.HostsContainer + FilteringEnabled bool + Filters []FilterYAML + FiltersUpdateIntervalHours uint32 + HTTPClient *http.Client + HTTPRegister aghhttp.RegisterFunc + ParentalBlockHost string + ParentalCacheSize uint + ParentalControlChecker Checker + ParentalEnabled bool + ProtectionDisabledUntil *time.Time + ProtectionEnabled bool + Rewrites []*LegacyRewrite + SafeBrowsingBlockHost string + SafeBrowsingCacheSize uint + SafeBrowsingChecker Checker + SafeBrowsingEnabled bool + SafeSearch SafeSearch + SafeSearchCacheSize uint + SafeSearchConf SafeSearchConfig + UserRules []string + WhitelistFilters []FilterYAML + type DNSFilter struct + func New(c *Config, blockFilters []Filter) (d *DNSFilter, err error) + func (d *DNSFilter) ApplyBlockedServices(setts *Settings) + func (d *DNSFilter) ApplyBlockedServicesList(setts *Settings, list []string) + func (d *DNSFilter) BlockedResponseTTL() (ttl uint32) + func (d *DNSFilter) BlockingMode() (mode BlockingMode, bIPv4, bIPv6 netip.Addr) + func (d *DNSFilter) CheckHost(host string, qtype uint16, setts *Settings) (res Result, err error) + func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) + func (d *DNSFilter) Close() + func (d *DNSFilter) EnableFilters(async bool) + func (d *DNSFilter) EtcHostsRecords(hostname string) (recs []*hostsfile.Record) + func (d *DNSFilter) ParentalBlockHost() (host string) + func (d *DNSFilter) ProtectionStatus() (status bool, disabledUntil *time.Time) + func (d *DNSFilter) RegisterFilteringHandlers() + func (d *DNSFilter) SafeBrowsingBlockHost() (host string) + func (d *DNSFilter) SetBlockedResponseTTL(ttl uint32) + func (d *DNSFilter) SetBlockingMode(mode BlockingMode, bIPv4, bIPv6 netip.Addr) + func (d *DNSFilter) SetEnabled(enabled bool) + func (d *DNSFilter) SetProtectionEnabled(status bool) + func (d *DNSFilter) SetProtectionStatus(status bool, disabledUntil *time.Time) + func (d *DNSFilter) Settings() (s *Settings) + func (d *DNSFilter) Start() + func (d *DNSFilter) WriteDiskConfig(c *Config) + type DNSRewriteResult struct + RCode rules.RCode + Response DNSRewriteResultResponse + type DNSRewriteResultResponse map[rules.RRType][]rules.RRValue + type Filter struct + Data []byte + FilePath string + ID int64 + type FilterYAML struct + Enabled bool + LastUpdated time.Time + Name string + RulesCount int + URL string + func (filter *FilterYAML) Path(dataDir string) string + type LegacyRewrite struct + Answer string + Domain string + IP netip.Addr + Type uint16 + func (rw *LegacyRewrite) Compare(b *LegacyRewrite) (res int) + type LookupStats struct + CacheHits uint64 + Pending int64 + PendingMax int64 + Requests uint64 + type Reason int + const FilteredBlockList + const FilteredBlockedService + const FilteredInvalid + const FilteredParental + const FilteredSafeBrowsing + const FilteredSafeSearch + const NotFilteredAllowList + const NotFilteredError + const NotFilteredNotFound + const Rewritten + const RewrittenAutoHosts + const RewrittenRule + func (r Reason) In(reasons ...Reason) (ok bool) + func (r Reason) Matched() bool + func (r Reason) String() string + type Resolver interface + LookupIP func(ctx context.Context, network, host string) (ips []net.IP, err error) + type Result struct + CanonName string + DNSRewriteResult *DNSRewriteResult + IPList []netip.Addr + IsFiltered bool + Reason Reason + Rules []*ResultRule + ServiceName string + type ResultRule struct + FilterListID int64 + IP netip.Addr + Text string + type SafeSearch interface + CheckHost func(host string, qtype uint16) (res Result, err error) + Update func(conf SafeSearchConfig) (err error) + type SafeSearchConfig struct + Bing bool + CustomResolver Resolver + DuckDuckGo bool + Enabled bool + Google bool + Pixabay bool + Yandex bool + YouTube bool + type ServiceEntry struct + Name string + Rules []*rules.NetworkRule + type Settings struct + ClientIP netip.Addr + ClientName string + ClientSafeSearch SafeSearch + ClientTags []string + FilteringEnabled bool + ParentalEnabled bool + ProtectionEnabled bool + SafeBrowsingEnabled bool + SafeSearchEnabled bool + ServicesRules []ServiceEntry + type Stats struct + Parental LookupStats + Safebrowsing LookupStats + Safesearch LookupStats