Documentation
¶
Index ¶
- Constants
- Variables
- func IsEmpty(s string) bool
- func RegisterInputConfigCreator(id string, fn inputConfigCreator) error
- func RegisterInputConverter(id string, converter InputConverter) error
- func RegisterOutputConfigCreator(id string, fn outputConfigCreator) error
- func RegisterOutputConverter(id string, converter OutputConverter) error
- func RemoveComment(line string) string
- type Action
- type Actioner
- type CaseRemove
- type Config
- type ConfigItem
- type Container
- type Descriptioner
- type Entry
- type InputConverter
- type Instance
- type OutputConverter
- type SimpleContainer
- func (c *SimpleContainer) Add(entry *Entry) error
- func (c *SimpleContainer) Get(name string) (*Entry, bool)
- func (c *SimpleContainer) GetEntry(name string) (*Entry, bool)
- func (c *SimpleContainer) GetNames() []string
- func (c *SimpleContainer) Has(name string) bool
- func (c *SimpleContainer) Len() int
- func (c *SimpleContainer) Loop() iter.Seq[*Entry]
- type Typer
Constants ¶
const ( ActionAdd Action = "add" ActionRemove Action = "remove" ActionOutput Action = "output" CaseRemovePrefix CaseRemove = 0 CaseRemoveEntry CaseRemove = 1 )
Variables ¶
var ActionsRegistry = map[Action]bool{ ActionAdd: true, ActionRemove: true, ActionOutput: true, }
Functions ¶
func RegisterInputConverter ¶
func RegisterInputConverter(id string, converter InputConverter) error
func RegisterOutputConverter ¶
func RegisterOutputConverter(id string, converter OutputConverter) error
func RemoveComment ¶
RemoveComment removes comments from a line
Types ¶
type CaseRemove ¶
type CaseRemove int
type Config ¶
type Config struct {
Input []ConfigItem `json:"input"`
Output []ConfigItem `json:"output"`
}
Config is the configuration for converting domain lists
type ConfigItem ¶
type ConfigItem struct {
Type string `json:"type"`
Action string `json:"action"`
Args json.RawMessage `json:"args"`
}
ConfigItem is a single input or output configuration
func (*ConfigItem) GetInputConverter ¶
func (c *ConfigItem) GetInputConverter() (InputConverter, error)
GetInputConverter returns an InputConverter for the ConfigItem
func (*ConfigItem) GetOutputConverter ¶
func (c *ConfigItem) GetOutputConverter() (OutputConverter, error)
GetOutputConverter returns an OutputConverter for the ConfigItem
func (*ConfigItem) UnmarshalJSON ¶
func (c *ConfigItem) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a ConfigItem from JSON
type Container ¶
type Container interface {
Add(entry *Entry) error
Get(name string) (*Entry, bool)
GetEntry(name string) (*Entry, bool)
Has(name string) bool
Loop() iter.Seq[*Entry]
Len() int
GetNames() []string
}
Container is a container for domain list entries
type Descriptioner ¶
type Descriptioner interface {
GetDescription() string
}
type Entry ¶
Entry is a single domain list entry
func (*Entry) AddDomains ¶
AddDomains adds multiple domains to the entry
func (*Entry) GetDomains ¶
GetDomains returns all domains in the entry
func (*Entry) MarshalText ¶
MarshalText converts the entry to text format
type InputConverter ¶
type Instance ¶
Instance is the main instance for converting domain lists
func (*Instance) InitConfig ¶
InitConfig initializes the instance with a config file
type OutputConverter ¶
type OutputConverter interface {
Typer
Actioner
Descriptioner
Output(Container) error
}
type SimpleContainer ¶
type SimpleContainer struct {
// contains filtered or unexported fields
}
SimpleContainer is a simple implementation of Container
func NewSimpleContainer ¶
func NewSimpleContainer() *SimpleContainer
NewSimpleContainer creates a new SimpleContainer
func (*SimpleContainer) Add ¶
func (c *SimpleContainer) Add(entry *Entry) error
Add adds an entry to the container
func (*SimpleContainer) Get ¶
func (c *SimpleContainer) Get(name string) (*Entry, bool)
Get retrieves an entry by name
func (*SimpleContainer) GetEntry ¶
func (c *SimpleContainer) GetEntry(name string) (*Entry, bool)
GetEntry retrieves an entry by name
func (*SimpleContainer) GetNames ¶
func (c *SimpleContainer) GetNames() []string
GetNames returns all entry names
func (*SimpleContainer) Has ¶
func (c *SimpleContainer) Has(name string) bool
Has checks if an entry exists