Documentation
¶
Index ¶
- type Loader
- func (l *Loader) Close() error
- func (l *Loader) Err() error
- func (l *Loader) Event() events.EveEvent
- func (l *Loader) LoadFile(path string) error
- func (l *Loader) LoadOneFile(path string) error
- func (l *Loader) LoadSTDIN()
- func (l *Loader) More() bool
- func (l *Loader) ParseAndCloseAsync(r io.ReadCloser)
- func (l *Loader) ParseAsync(r io.Reader)
- func (l *Loader) Scan(r io.Reader)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader is a struct that loads events from a file or stream asynchronously into a queue.
func NewLoader ¶
func NewLoader() *Loader
Example ¶
loader := NewLoader()
// Load the eve.json file asynchronously
if err := loader.LoadOneFile("pathto/eve.json"); err != nil {
log.Fatal(err)
}
// Range over the events and print dns answers to stdout
for loader.More() {
if err := loader.Err(); err != nil {
log.Fatal(err)
}
event := loader.Event()
if !event.DNS.Empty() && event.DNS.Type == "answer" {
log.Println(event.DNS)
}
}
if err := loader.Err(); err != nil {
log.Fatal(err)
}
func (*Loader) Close ¶ added in v0.1.0
Close closes the loader and prevents further processing. This will cause Loader.More to return false.
func (*Loader) Event ¶
Event removes and returns the next events.EveEvent from the queue.
func (*Loader) LoadFile ¶
LoadFile loads a file, parses it, and closes it asynchronously. It does NOT call Loader.Close when finished, so Loader.More will return true.
func (*Loader) LoadOneFile ¶ added in v0.1.0
LoadOneFile loads a file, parses it, and closes it asynchronously. It also calls Loader.Close when finished, causing Loader.More to return false.
func (*Loader) LoadSTDIN ¶ added in v0.1.0
func (l *Loader) LoadSTDIN()
LoadSTDIN loads from stdin and parses it asynchronously. It does NOT call Loader.Close when finished, so Loader.More will return true.
func (*Loader) ParseAndCloseAsync ¶ added in v0.1.0
func (l *Loader) ParseAndCloseAsync(r io.ReadCloser)
ParseAndCloseAsync parses the input stream and closes it asynchronously. It also calls Loader.Close when finished, causing Loader.More to return false.
func (*Loader) ParseAsync ¶ added in v0.1.0
ParseAsync parses the input stream asynchronously.