Documentation ¶
Index ¶
- Constants
- Variables
- func GetRemoteURLContent(url string) ([]byte, error)
- func GetRemoteURLReader(url string) (io.ReadCloser, error)
- func ListInputConverter()
- func ListOutputConverter()
- func RegisterInputConfigCreator(id string, fn inputConfigCreator) error
- func RegisterInputConverter(name string, c InputConverter) error
- func RegisterOutputConfigCreator(id string, fn outputConfigCreator) error
- func RegisterOutputConverter(name string, c OutputConverter) error
- type Action
- type Actioner
- type CaseRemove
- type Container
- type Descriptioner
- type Entry
- func (e *Entry) AddPrefix(cidr any) error
- func (e *Entry) GetIPv4Set() (*netipx.IPSet, error)
- func (e *Entry) GetIPv6Set() (*netipx.IPSet, error)
- func (e *Entry) GetName() string
- func (e *Entry) MarshalIPRange(opts ...IgnoreIPOption) ([]netipx.IPRange, error)
- func (e *Entry) MarshalPrefix(opts ...IgnoreIPOption) ([]netip.Prefix, error)
- func (e *Entry) MarshalText(opts ...IgnoreIPOption) ([]string, error)
- func (e *Entry) RemovePrefix(cidr string) error
- type IPType
- type IgnoreIPOption
- type InputConverter
- type Instance
- type OutputConverter
- type Typer
Constants ¶
View Source
const ( ActionAdd Action = "add" ActionRemove Action = "remove" ActionOutput Action = "output" IPv4 IPType = "ipv4" IPv6 IPType = "ipv6" CaseRemovePrefix CaseRemove = 0 CaseRemoveEntry CaseRemove = 1 )
Variables ¶
View Source
var ( ErrDuplicatedConverter = errors.New("duplicated converter") ErrUnknownAction = errors.New("unknown action") ErrNotSupportedFormat = errors.New("not supported format") ErrInvalidIPType = errors.New("invalid IP type") ErrInvalidIP = errors.New("invalid IP address") ErrInvalidIPLength = errors.New("invalid IP address length") ErrInvalidIPNet = errors.New("invalid IPNet address") ErrInvalidCIDR = errors.New("invalid CIDR") ErrInvalidPrefix = errors.New("invalid prefix") ErrInvalidPrefixType = errors.New("invalid prefix type") ErrCommentLine = errors.New("comment line") )
View Source
var ActionsRegistry = map[Action]bool{ ActionAdd: true, ActionRemove: true, ActionOutput: true, }
Functions ¶
func GetRemoteURLContent ¶
func GetRemoteURLReader ¶
func GetRemoteURLReader(url string) (io.ReadCloser, error)
func ListInputConverter ¶
func ListInputConverter()
func ListOutputConverter ¶
func ListOutputConverter()
func RegisterInputConverter ¶
func RegisterInputConverter(name string, c InputConverter) error
func RegisterOutputConverter ¶
func RegisterOutputConverter(name string, c OutputConverter) error
Types ¶
type CaseRemove ¶
type CaseRemove int
type Container ¶
type Container interface { GetEntry(name string) (*Entry, bool) Len() int Add(entry *Entry, opts ...IgnoreIPOption) error Remove(entry *Entry, rCase CaseRemove, opts ...IgnoreIPOption) error Loop() <-chan *Entry Lookup(ipOrCidr string, searchList ...string) ([]string, bool, error) }
func NewContainer ¶
func NewContainer() Container
type Descriptioner ¶
type Descriptioner interface {
GetDescription() string
}
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
func (*Entry) MarshalIPRange ¶
func (e *Entry) MarshalIPRange(opts ...IgnoreIPOption) ([]netipx.IPRange, error)
func (*Entry) MarshalPrefix ¶
func (e *Entry) MarshalPrefix(opts ...IgnoreIPOption) ([]netip.Prefix, error)
func (*Entry) MarshalText ¶
func (e *Entry) MarshalText(opts ...IgnoreIPOption) ([]string, error)
func (*Entry) RemovePrefix ¶
type IPType ¶
type IPType string
func IgnoreIPv4 ¶
func IgnoreIPv4() IPType
func IgnoreIPv6 ¶
func IgnoreIPv6() IPType
type IgnoreIPOption ¶
type IgnoreIPOption func() IPType
type InputConverter ¶
type Instance ¶
type Instance interface { InitConfig(configFile string) error InitConfigFromBytes(content []byte) error AddInput(InputConverter) AddOutput(OutputConverter) ResetInput() ResetOutput() RunInput(Container) error RunOutput(Container) error Run() error }
func NewInstance ¶
type OutputConverter ¶
type OutputConverter interface { Typer Actioner Descriptioner Output(Container) error }
Click to show internal directories.
Click to hide internal directories.