deliverer

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTLSConfig *tls.Config = nil

Functions

This section is empty.

Types

type ACL added in v1.0.0

type ACL struct {
	IP     []netip.Addr
	CIDR   []netip.Prefix
	Domain []Domain
}

func NewACL added in v1.0.0

func NewACL(opts AclOptions) *ACL

func (*ACL) Allow added in v1.0.0

func (acl *ACL) Allow(host string, addr netip.Addr) bool

type AclDecision added in v1.0.0

type AclDecision struct {
	Denied bool
}

type AclOptions added in v1.0.0

type AclOptions struct {
	Rules []string
}

type Deliverer

type Deliverer interface {
	Deliver(ctx context.Context, req *Request) (res *Response)
}

type Domain added in v1.0.0

type Domain string

func (Domain) Match added in v1.0.0

func (d Domain) Match(host string) bool

type HTTPDeliverer

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

HTTPDeliverer delivers via HTTP

func NewHTTPDeliverer

func NewHTTPDeliverer(opts Options) *HTTPDeliverer

func (*HTTPDeliverer) Deliver

func (d *HTTPDeliverer) Deliver(ctx context.Context, req *Request) (res *Response)

func (*HTTPDeliverer) SetupACL added in v1.0.0

func (d *HTTPDeliverer) SetupACL(opts AclOptions) error

func (*HTTPDeliverer) SetupProxy added in v1.0.0

func (d *HTTPDeliverer) SetupProxy(opts ProxyOptions) error

type Options added in v1.0.0

type Options struct {
	Logger         *zap.SugaredLogger
	RequestTimeout time.Duration
}

type ProxyOptions added in v1.0.0

type ProxyOptions struct {
	URL              string
	TLSCert          string
	TLSKey           string
	TLSCaCertificate string
	TLSVerify        bool
}

type Request

type Request struct {
	Request *http.Request
	URL     string
	Method  string
	Payload []byte
	Headers map[string]string
	Timeout time.Duration
}

type Resolver added in v1.0.0

type Resolver interface {
	LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error)
}
var DefaultResolver Resolver = net.DefaultResolver

type Response

type Response struct {
	Request         *Request
	ACL             AclDecision
	StatusCode      int
	Header          http.Header
	ResponseBody    []byte
	Error           error
	Latancy         time.Duration
	ProxyStatusCode int
}

func (*Response) Is2xx

func (r *Response) Is2xx() bool

func (*Response) String

func (r *Response) String() string

Jump to

Keyboard shortcuts

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