dnsproxy

package
v10.323.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSProxy

type DNSProxy interface {

	// StartDNSServer starts the dns server on the port provided for contextID
	StartDNSServer(ctx context.Context, contextID, port string) error

	// Enforce starts enforcing policies for the given policy.PUInfo.
	Enforce(ctx context.Context, contextID string, puInfo *policy.PUInfo) error

	// Unenforce stops enforcing policy for the given IP.
	Unenforce(ctx context.Context, contextID string) error

	// SyncWithPlatformCache is only needed in Windows
	SyncWithPlatformCache(ctx context.Context, pctx *pucontext.PUContext) error

	// HandleDNSResponsePacket is only needed in Windows
	HandleDNSResponsePacket(dnsPacketData []byte, sourceIP net.IP, sourcePort uint16, destIP net.IP, destPort uint16, puFromContextID func(string) (*pucontext.PUContext, error)) error
}

DNSProxy defines an interface that trireme uses for Dns Proxy

type Proxy

type Proxy struct {
	IPToTTL      *cache.Cache
	IPToTTLLocks *mutexMap

	sync.Mutex
	// contains filtered or unexported fields
}

Proxy struct represents the object for dns proxy

func New

func New(puFromID cache.DataStore, conntrack flowtracking.FlowClient, c collector.EventCollector, aclmanager ipsetmanager.ACLManager) *Proxy

New creates an instance of the dns proxy

func (*Proxy) Enforce

func (p *Proxy) Enforce(ctx context.Context, contextID string, puInfo *policy.PUInfo) error

Enforce starts enforcing policies for the given policy.PUInfo.

func (*Proxy) HandleDNSResponsePacket

func (p *Proxy) HandleDNSResponsePacket(dnsPacketData []byte, sourceIP net.IP, sourcePort uint16, destIP net.IP, destPort uint16, puFromContextID func(string) (*pucontext.PUContext, error)) error

HandleDNSResponsePacket is only needed in Windows currently

func (*Proxy) ShutdownDNS

func (p *Proxy) ShutdownDNS(contextID string)

ShutdownDNS shuts down the dns server for contextID

func (*Proxy) StartDNSServer

func (p *Proxy) StartDNSServer(contextID, port string) error

StartDNSServer starts the dns server on the port provided for contextID

func (*Proxy) SyncWithPlatformCache

func (p *Proxy) SyncWithPlatformCache(ctx context.Context, pctx *pucontext.PUContext) error

SyncWithPlatformCache is only needed in Windows currently

func (*Proxy) Unenforce

func (p *Proxy) Unenforce(_ context.Context, contextID string) error

Unenforce stops enforcing policy for the given IP.

Directories

Path Synopsis
Package mockdnsproxy is a generated GoMock package.
Package mockdnsproxy is a generated GoMock package.

Jump to

Keyboard shortcuts

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