Versions in this module Expand all Collapse all v1 v1.0.0 Mar 15, 2024 Changes in this version + const ErrEmptyLine + const ErrNoHosts + func DefaultHostsPaths() (p []string, err error) + func Parse(dst Set, src io.Reader, buf []byte) (err error) + type DefaultStorage struct + func NewDefaultStorage(readers ...io.Reader) (s *DefaultStorage, err error) + func (s *DefaultStorage) Add(rec *Record) + func (s *DefaultStorage) ByAddr(addr netip.Addr) (hosts []string) + func (s *DefaultStorage) ByName(host string) (addrs []netip.Addr) + func (s *DefaultStorage) Equal(other *DefaultStorage) (ok bool) + func (s *DefaultStorage) HandleInvalid(srcName string, _ []byte, err error) + func (s *DefaultStorage) RangeAddrs(f func(host string, addrs []netip.Addr) (cont bool)) + func (s *DefaultStorage) RangeNames(f func(addr netip.Addr, names []string) (cont bool)) + type DiscardSet struct + func (DiscardSet) Add(_ *Record) + type FuncSet func(rec *Record) + func (f FuncSet) Add(rec *Record) + type HandleSet interface + HandleInvalid func(srcName string, data []byte, err error) + type LineError struct + Line int + func (e *LineError) Error() (msg string) + func (e *LineError) Unwrap() (unwrapped error) + type NamedReader interface + Name func() (name string) + type Record struct + Addr netip.Addr + Names []string + Source string + func (rec *Record) UnmarshalText(data []byte) (err error) + func (rec Record) MarshalText() (data []byte, err error) + type Set interface + Add func(rec *Record) + type Storage interface + ByAddr func(addr netip.Addr) (names []string) + ByName func(name string) (addrs []netip.Addr)