Documentation ¶
Index ¶
- Constants
- Variables
- func GuessAddr() string
- func HandleSignals(cancel context.CancelFunc)
- func Serve(ctx context.Context, p *Params) (err error)
- type Log
- func (l *Log) Debug(args ...interface{})
- func (l *Log) Debugf(fmt string, args ...interface{})
- func (l *Log) DefaultInit(network, addr, tag string, debug bool) (err error)
- func (l *Log) Error(args ...interface{})
- func (l *Log) Errorf(fmt string, args ...interface{})
- func (l *Log) Info(args ...interface{})
- func (l *Log) Infof(fmt string, args ...interface{})
- type Logger
- type Node
- type PacketMode
- type Params
Constants ¶
View Source
const ( DefaultPort = 17106 DefaultFeatureDir = "/etc/nameq/features" DefaultStateDir = "/run/nameq/state" )
Default values for some Params.
Variables ¶
View Source
var ( // Preset dictionary used for compressing UDP packets with DEFLATE. PacketCompressionDict = []byte("{\"ip_addr\":\",\"time_ns\":,\"names\":[\",\"],\"features\":{\":true,\"}}}") )
Functions ¶
func GuessAddr ¶
func GuessAddr() string
GuessAddr tries to find a local interface suitable for the Addr parameter.
func HandleSignals ¶
func HandleSignals(cancel context.CancelFunc)
HandleSignals cancels on termination or interrupt.
Types ¶
type Log ¶
Log configures optional loggers.
func (*Log) DefaultInit ¶
DefaultInit configures at least the error and info loggers, targetting stderr or syslog.
type Logger ¶
type Logger interface { Print(v ...interface{}) Printf(format string, v ...interface{}) }
Logger is a subset of the standard log.Logger.
type Node ¶
type Node struct { IPAddr string `json:"ip_addr,omitempty"` TimeNs int64 `json:"time_ns,omitempty"` Features map[string]*json.RawMessage `json:"features,omitempty"` }
Node is a JSON-compatible representation of a host. IPAddr and TimeNs are used when sending via UDP, but not when stored in S3.
type PacketMode ¶
type PacketMode struct { Id int // Identifies the configuration. Must be in range [0..255]. Secret []byte // The shared HMAC-SHA1 key. }
PacketMode specifies a shared UDP packet configuration.
type Params ¶
type Params struct { Addr string // Required. Port int Features string FeatureDir string StateDir string SendMode *PacketMode // Required. ReceiveModes map[int]*PacketMode // Defaults to SendMode. S3Creds []byte S3Region string // Required unless S3DryRun is set. S3Bucket string // Required unless S3DryRun is set. S3Prefix string S3DryRun bool Log Log }
Params of the service.
func DefaultParams ¶
func DefaultParams() *Params
DefaultParams fills in some values. Log is not initialized.
Click to show internal directories.
Click to hide internal directories.