Documentation
¶
Overview ¶
Package rewrite implements DNS Rewrites storage and request matching.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultStorage ¶
type DefaultStorage struct {
// contains filtered or unexported fields
}
DefaultStorage is the default storage for rewrite rules.
func NewDefaultStorage ¶
func NewDefaultStorage(listID int, rewrites []*Item) (s *DefaultStorage, err error)
NewDefaultStorage returns new rewrites storage. listID is used as an identifier of the underlying rules list. rewrites must not be nil.
func (*DefaultStorage) Add ¶
func (s *DefaultStorage) Add(item *Item) (err error)
Add implements the Storage interface for *DefaultStorage.
func (*DefaultStorage) List ¶
func (s *DefaultStorage) List() (items []*Item)
List implements the Storage interface for *DefaultStorage.
func (*DefaultStorage) MatchRequest ¶
func (s *DefaultStorage) MatchRequest(dReq *urlfilter.DNSRequest) (rws []*rules.DNSRewrite)
MatchRequest implements the Storage interface for *DefaultStorage.
type Item ¶
type Item struct {
// Domain is the domain pattern for which this rewrite should work.
Domain string `yaml:"domain"`
// Answer is the IP address, canonical name, or one of the special
// values: "A" or "AAAA".
Answer string `yaml:"answer"`
}
Item is a single DNS rewrite record.
type Storage ¶
type Storage interface {
// MatchRequest returns matching dnsrewrites for the specified request.
MatchRequest(dReq *urlfilter.DNSRequest) (rws []*rules.DNSRewrite)
// Add adds item to the storage.
Add(item *Item) (err error)
// Remove deletes item from the storage.
Remove(item *Item) (err error)
// List returns all items from the storage.
List() (items []*Item)
}
Storage is a storage for rewrite rules.
Click to show internal directories.
Click to hide internal directories.