proxy

package
v0.0.0-...-db96cfc Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessRule

type AccessRule struct {
	Pattern *Pattern
	Token   string
}

AccessRule defines a pattern and the corresponding auth key

func (*AccessRule) CheckAuth

func (a *AccessRule) CheckAuth(token string) bool

CheckAuth validate a given token against the AccessRule token

type AccessRules

type AccessRules []*AccessRule

AccessRules is a list of AccessRules

func NewAccessRulesFromConfig

func NewAccessRulesFromConfig(accessRulesCfg config.AccessRules) (AccessRules, error)

NewAccessRulesFromConfig creates AccessRules from configuration

func (AccessRules) Search

func (a AccessRules) Search(fqdn string) *AccessRule

Search for a access rule by FQDN

type Pattern

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

Pattern is a glob-like string for AccessRule

func CompilePattern

func CompilePattern(source string) (*Pattern, error)

CompilePattern creates a Pattern form a given string

func MustCompilePattern

func MustCompilePattern(source string) *Pattern

MustCompilePattern creates a Pattern form a given string. Panics in case of an error

func (*Pattern) Match

func (p *Pattern) Match(s string) bool

Match the pattern with a given string

func (*Pattern) String

func (p *Pattern) String() string

String returns the pattern as string

type Proxy

type Proxy struct {
	Logger      *zap.Logger
	Provider    dns.Provider
	AccessRules AccessRules
}

Proxy handles incoming request and calls the DNS provider API.

func (*Proxy) Handle

func (p *Proxy) Handle(req *Request) error

Handle validates and authenticates a request. If everything is fine, the configured DNS provider API gets called.

type Remote

type Remote struct {
	Addr string // Addr is the address of the client
	Name string // Name is the name of the client. This depends on the client and can be for example go/lego for lego
}

Remote holds information about the remote client.

type Request

type Request struct {
	Action    string        // Action for the current request. Can be present or cleanup
	AuthToken string        // AuthToken for the current request
	Challenge dns.Challenge // Challenge for the current request
	Remote    Remote        // Remote information for the current request
}

Request holds information about the request.

Jump to

Keyboard shortcuts

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