bloom

package module
v0.0.0-...-0ce208a Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

Bloom Filter CoreDNS Plugin

Serves up a bloom file as a DNS zone. Useful to make bloom filter queries available via the network

Compilation

This package will always be compiled as part of CoreDNS and not in a standalone way. It will require you to use go get or as a dependency on plugin.cfg.

The manual will have more information about how to configure and extend the server with external plugins.

A simple way to consume this plugin, is by adding the following on plugin.cfg, and recompile it as detailed on coredns.io.

bloom:github.com/mosajjal/bloom-coredns

Put this early in the plugin list, so that bloom is executed before any of the other plugins.

After this you can compile coredns by:

go generate
go build

Or you can instead use make:

make

Syntax

bloom

Metrics

If monitoring is enabled (via the prometheus directive) the following metric is exported:

  • coredns_bloom_request_count_total{server} - query count to the bloom plugin.

The server label indicated which server handled the request, see the metrics plugin for details.

Ready

This plugin reports readiness to the ready plugin. It will be immediately ready.

Examples

In this configuration, we configure a bloom filter consisting SHA1 hashes of known files in the OS

. {
    bloom /opt/mybloom/hashes.bloom  
}

If the bloom is gzipped:

. {
    bloom /opt/mybloom/hashes.bloom.gz gzip
}

if the query exists, the result would be a NOERROR CNAME with the input plus a trailing . at the end. if the query is not present, you'll get an empty NXDOMAIN response. note that bloom filters are case-sensitive hence the DNS query and responses are also case-preserving. This behaviour is not strictly RFC-compliant, so take that into account if you're planning to put this instance of coredns behind other DNS servers. always keeping client, server and blooms lower-case solves this issue.

Also See

See the manual.

Documentation

Overview

Package bloom is a CoreDNS plugin that gets a bloom file as an input and serves it as a DNS zone. NXDOMAIN means no match and NOERROR means a match

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bloom

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

Bloom plugin

func (Bloom) Name

func (e Bloom) Name() string

Name implements the Handler interface.

func (Bloom) Ready

func (e Bloom) Ready() bool

Ready implements the ready.Readiness interface, once this flips to true CoreDNS assumes this plugin is ready for queries; it is not checked again.

func (Bloom) ServeDNS

func (e Bloom) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface. This method gets called when example is used in a Server.

type ResponsePrinter

type ResponsePrinter struct {
	dns.ResponseWriter
}

ResponsePrinter wrap a dns.ResponseWriter and will write example to standard output when WriteMsg is called.

func NewResponsePrinter

func NewResponsePrinter(w dns.ResponseWriter) *ResponsePrinter

NewResponsePrinter returns ResponseWriter.

func (*ResponsePrinter) WriteMsg

func (r *ResponsePrinter) WriteMsg(res *dns.Msg) error

WriteMsg calls the underlying ResponseWriter's WriteMsg method and prints "example" to standard output.

Jump to

Keyboard shortcuts

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