nsrecorder

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 13 Imported by: 0

README

nsrecorder

nsr listens for events published to NSQ by nspub, and records them.

The docker image expects a volume mounted at /var/lib/data in which it will create the sqlite db file, which defaults to nsr.db

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInitializationFailed = errors.New("initialization failed")
)
View Source
var Version = "0.0.1"

Functions

This section is empty.

Types

type Answer

type Answer struct {
	Hdr  Header
	A    string
	AAAA string
}

Answer is the simplified structure for deserialization.

type Client

type Client struct {
	Name string `json:"name"`
	IP   string `json:"ip"`
}
type Header struct {
	Name string
}

Header is the simplified structure for deserialization.

type Lookup

type Lookup struct {
	When    time.Time `json:"when"`
	Client  string    `json:"client"`
	Host    string    `json:"host"`
	Type    string    `json:"type"`
	FirstIP string    `json:"first_ip"`
	AllIPs  []string  `json:"all_ips"`
}

type Message

type Message struct {
	ClientIP string
	Time     time.Time
	Msg      Msg
}

Message is the simplified structure for deserialization.

type Msg

type Msg struct {
	ID       int
	Question []Question
	Answer   []Answer
}

Msg is the simplified structure for deserialization.

type Question

type Question struct {
	Name string
}

Question is the simplified structure for deserialization.

type Store

type Store interface {
	Accept([]Client, []Lookup) error
}

func MultiStore

func MultiStore(stores ...Store) Store

func NewLogStore

func NewLogStore() Store

func NewSQLiteStore

func NewSQLiteStore(path string) Store

type Watcher

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

func NewWatcher

func NewWatcher(ctx context.Context, store Store) *Watcher

func (*Watcher) HandleMessage

func (w *Watcher) HandleMessage(message *nsq.Message) error

func (*Watcher) Stop

func (w *Watcher) Stop()

Directories

Path Synopsis
cmd
nsr

Jump to

Keyboard shortcuts

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