dnslogging

package module
v0.0.0-...-6c9ed35 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MPL-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Build Status codecov GitHub version GitHub issues GitHub pull requests Go Report Card

CoreDNS dnslogging

This CoreDNS plugin forwards all DNS transactions to a Nats server specified by the config. Currently the format sent over the line is dictated by the cap'n proto files.

WIP Document

Documentation

Index

Constants

View Source
const PluginName string = "dnslogging"

PluginName is the name of our plugin

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Publish takes a request and publishes it to the streaming service, this should ideally be batching for performance, but that is left to programmer.
	Publish(req *dns.Msg, resp *dns.Msg) error
}

Client is the interface that other stremaing clients must implement to be used.

type DNSLogging

type DNSLogging struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

DNSLogging is our plugin struct. No configurations being persisted at this time

func New

func New() (*DNSLogging, error)

New creates a new instance of the DNSLogging type

func (*DNSLogging) Close

func (dl *DNSLogging) Close()

Close will drain and close of the nats connection

func (*DNSLogging) Initialize

func (dl *DNSLogging) Initialize() (err error)

Initialize handles the initial connection to the nats server.

func (*DNSLogging) Name

func (dl *DNSLogging) Name() string

Name is the name of our plugin

func (*DNSLogging) ServeDNS

func (dl *DNSLogging) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (rc int, err error)

ServeDNS is doing the forwarding, this call can, and will fail since DNS resolution to the client should have succeeded by now

type Error

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

Error type for the dns logging plugin

func (*Error) Error

func (e *Error) Error() string

type KafkaClient

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

KafkaClient contains a kafka writer which can be used to async send messages to kafka

func NewKafkaClient

func NewKafkaClient(brokers []string, topic string) (kc *KafkaClient, err error)

NewKafkaClient creates a kafka client for the plugin to publish to

func (*KafkaClient) Publish

func (kc *KafkaClient) Publish(log *Log) (err error)

Publish sends a log object to kafka

type Log

type Log struct {
	Req  *dns.Msg
	Resp *dns.Msg
}

type NatsClient

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

func NewNatsClient

func NewNatsClient(natsURL string) (_ *NatsClient, err error)

NewNatsClient returns a connected Nats Client

func (*NatsClient) Publish

func (nc *NatsClient) Publish(log *Log) error

Jump to

Keyboard shortcuts

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