pot

package
v0.0.0-...-4baded3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2017 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlacklistMap

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

BlacklistMap wraps a Map by checking first the requested domain against a blacklist. If the domain appears in the blacklist, no further lookups are made and a permanent error is returned.

func NewBlacklistMap

func NewBlacklistMap(wrap Map) *BlacklistMap

NewBlacklistMap creates a BlacklistMap wrapping the given Map.

func (*BlacklistMap) Add

func (m *BlacklistMap) Add(domain string)

Add a domain to the blacklist.

func (*BlacklistMap) Lookup

func (m *BlacklistMap) Lookup(domain string) (string, error)

type Map

type Map interface {
	// Lookup a domain in the map. A note on error semantics: if
	// the lookup is successful and the domain is not found, the
	// result string will be empty and error will be nil. If there
	// is an error in the lookup, error will be non-nil.
	Lookup(string) (string, error)
}

Map implements a domain-based lookup table.

func NewDNSLookupMap

func NewDNSLookupMap(service, transport string) Map

NewDNSLookupMap returns a Map that looks up DNS SRV records and returns a result of the form transport:[SRV target].

func NewLimitMap

func NewLimitMap(maxInflight int, wrap Map) Map

NewLimitMap wraps a Map with overload protection based on the number of inflight requests.

type Server

type Server struct {

	// EnableDebug enables debug logging of every request.
	EnableDebug bool
	// contains filtered or unexported fields
}

Server implements the protocol described in Postfix's tcp_table(5).

func NewServer

func NewServer(l net.Listener, lmap Map) *Server

NewServer builds a new Server using the given Listener and Map.

func (*Server) Close

func (s *Server) Close() error

Close the listener and free all associated resources.

func (*Server) Serve

func (s *Server) Serve() error

Serve requests forever (or until a fatal error occurs).

Jump to

Keyboard shortcuts

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