portal

package
v0.0.0-...-6684604 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TrustLevelValues = []string{"proxy", "client", "connection"}

Functions

func SecureCompare

func SecureCompare(want, have string) bool

SecureCompare performs a constant time compare of two strings to limit timing attacks. https://go.dev/play/p/NU5uTaB-sp

Types

type Config

type Config struct {
	PushInterval     time.Duration
	LogInterval      time.Duration
	AutoPushDelay    time.Duration
	TrustLevel       TrustLevel
	AuthUsername     string
	AuthPassword     string
	AuthPasswordFile string
}

func (*Config) ParseCredentials

func (c *Config) ParseCredentials() (*url.Userinfo, error)

type Portal

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

func New

func New(c *Config, db *dao.DAO, l log.Logger) (*Portal, error)

func (*Portal) Dump

func (p *Portal) Dump(w io.Writer) error

func (*Portal) Error

func (p *Portal) Error(msg string) *response.Root

func (*Portal) Process

func (p *Portal) Process(r *Request) (*response.Root, error)

func (*Portal) Success

func (p *Portal) Success() *response.Root

func (*Portal) TrustLevel

func (p *Portal) TrustLevel() TrustLevel

type Request

type Request struct {
	Credentials *url.Userinfo
	Payload     *request.Root
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(ctx context.Context, client *netip.Addr) *Request

func (*Request) Client

func (r *Request) Client() *netip.Addr

func (*Request) CompareCredentials

func (r *Request) CompareCredentials(c *url.Userinfo) bool

func (*Request) Context

func (r *Request) Context() context.Context

type TrustLevel

type TrustLevel string
const (
	ProxyTrustLevel      TrustLevel = "proxy"
	ClientTrustLevel     TrustLevel = "client"
	ConnectionTrustLevel TrustLevel = "connection"
)

func (*TrustLevel) Set

func (t *TrustLevel) Set(s string) error

Set updates the value of the trust level.

func (TrustLevel) String

func (t TrustLevel) String() string

Directories

Path Synopsis
dao
dto

Jump to

Keyboard shortcuts

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