rewrites

package
v0.0.0-...-f0fecd2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const SelfAddrName = "self"

Variables

View Source
var ErrInvalidIP = fmt.Errorf("invalid ip")

Functions

This section is empty.

Types

type Addr

type Addr struct {
	Name string
	IP   netip.Addr
}

type CacheStorage

type CacheStorage struct {
	// contains filtered or unexported fields
}

CacheStorage stores and gives rewrites and addr mappings It should cache them between updates

func NewStorage

func NewStorage(datastore datastore.Storage, selfAddr string) (*CacheStorage, error)

func (*CacheStorage) AddAddr

func (s *CacheStorage) AddAddr(name string, ip string) error

func (*CacheStorage) AddRewrite

func (s *CacheStorage) AddRewrite(domain string, matchType string, addr string) error

func (*CacheStorage) DeleteAddr

func (s *CacheStorage) DeleteAddr(name string) error

func (*CacheStorage) DeleteRewrite

func (s *CacheStorage) DeleteRewrite(domain string, matchType string) error

func (*CacheStorage) GetAddrs

func (s *CacheStorage) GetAddrs() []Addr

func (*CacheStorage) GetRewrites

func (s *CacheStorage) GetRewrites() EntrySet

type Entry

type Entry struct {
	Domain   string
	AddrName string
	IP       netip.Addr
	Type     MatchType
}

type EntrySet

type EntrySet struct {
	Strict []Entry
	Suffix []Entry
}

func (EntrySet) All

func (entries EntrySet) All() []Entry

func (EntrySet) SortedByDomain

func (entries EntrySet) SortedByDomain() []Entry

type MatchType

type MatchType string
const (
	MatchTypeStrict MatchType = "strict"
	MatchTypeSuffix MatchType = "suffix"
)

func (MatchType) String

func (m MatchType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL