parsers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBytes

func ParseBytes(data []byte, parser Parser) (<-chan Item, error)

func ParseFile

func ParseFile(filename string, parser Parser) (<-chan Item, error)

Types

type Item

type Item struct {
	Type     ListType
	Value    string
	Metadata map[string]interface{}
}

type ListType

type ListType string
const (
	Domain ListType = "Domain"
	URL    ListType = "URL"
	IPv4   ListType = "IPv4"
	IPv6   ListType = "IPv6"
	Email  ListType = "Email"
)

type Parser

type Parser interface {
	Parse(reader io.Reader, itemChan chan<- Item) error
}

type TextParser

type TextParser struct {
	ParseFunc func(string) (Item, bool)
}

func (*TextParser) Parse

func (p *TextParser) Parse(reader io.Reader, itemChan chan<- Item) error

Jump to

Keyboard shortcuts

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