filtering

package
v3.11.0-beta.1 Latest Latest
Warning

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

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

Documentation

Overview

Package filtering contains primitives for implementing filtering.

Index

Constants

View Source
const (
	// DNSActionProxy proxies the traffic to the upstream server.
	DNSActionProxy = DNSAction(iota)

	// DNSActionNXDOMAIN replies with NXDOMAIN.
	DNSActionNXDOMAIN

	// DNSActionRefused replies with Refused.
	DNSActionRefused

	// DNSActionLocalHost replies with `127.0.0.1` and `::1`.
	DNSActionLocalHost

	// DNSActionEmpty returns an empty reply.
	DNSActionEmpty

	// DNSActionTimeout never replies to the query.
	DNSActionTimeout
)
View Source
const (
	// TLSActionProxy proxies the traffic to the destination.
	TLSActionProxy = TLSAction(iota)

	// TLSActionReset resets the connection.
	TLSActionReset

	// TLSActionTimeout causes the connection to timeout.
	TLSActionTimeout

	// TLSActionEOF closes the connection.
	TLSActionEOF

	// TLSActionAlertInternalError sends an internal error
	// alert message to the TLS client.
	TLSActionAlertInternalError

	// TLSActionAlertUnrecognizedName tells the client that
	// it's handshaking with an unknown SNI.
	TLSActionAlertUnrecognizedName
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSAction

type DNSAction int

DNSAction is the action that this proxy should take.

type DNSListener

type DNSListener interface {
	io.Closer
	LocalAddr() net.Addr
}

DNSListener is the interface returned by DNSProxy.Start

type DNSProxy

type DNSProxy struct {
	// OnQuery is the MANDATORY hook called whenever we
	// receive a query for the given domain.
	OnQuery func(domain string) DNSAction

	// Upstream is the OPTIONAL upstream transport.
	Upstream DNSTransport
	// contains filtered or unexported fields
}

DNSProxy is a DNS proxy that routes traffic to an upstream resolver and may implement filtering policies.

func (*DNSProxy) Start

func (p *DNSProxy) Start(address string) (DNSListener, error)

Start starts the proxy.

type DNSTransport

type DNSTransport interface {
	RoundTrip(ctx context.Context, query []byte) ([]byte, error)
	CloseIdleConnections()
}

DNSTransport is the type we expect from an upstream DNS transport.

type TLSAction

type TLSAction int

TLSAction is the action that this proxy should take.

type TLSProxy

type TLSProxy struct {
	// OnIncomingSNI is the MANDATORY hook called whenever we have
	// successfully received a ClientHello message.
	OnIncomingSNI func(sni string) TLSAction
}

TLSProxy is a TLS proxy that routes the traffic depending on the SNI value and may implement filtering policies.

func (*TLSProxy) Start

func (p *TLSProxy) Start(address string) (net.Listener, error)

Start starts the proxy.

Jump to

Keyboard shortcuts

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