server

package
v0.0.0-...-cd79bee Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecurityHeadersHandler

func SecurityHeadersHandler(next http.Handler) http.Handler

SecurityHeadersHandler returns a middleware which sets common security HTTP headers on the response to mitigate common web vulnerabilities.

Types

type Database

type Database interface {
	Get(key string) (farpass.Secret, error)
	Put(key string, secret farpass.Secret) error
	Delete(key string) (bool, error)
	Status(key string) (oneTime bool, err error)
}

Database interface

func NewMemcached

func NewMemcached(server string) Database

NewMemcached returns a new memcached database client

func NewRedis

func NewRedis(url string) (Database, error)

NewRedis returns a new Redis database client

type Memcached

type Memcached struct {
	Client *memcache.Client
}

Memcached client

func (*Memcached) Delete

func (m *Memcached) Delete(key string) (bool, error)

Delete key from memcached

func (*Memcached) Get

func (m *Memcached) Get(key string) (farpass.Secret, error)

Get key in memcached

func (*Memcached) Put

func (m *Memcached) Put(key string, secret farpass.Secret) error

Put key in Memcached

func (*Memcached) Status

func (m *Memcached) Status(key string) (bool, error)

Status returns whether the secret exists and if it is one-time

type Redis

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

Redis client

func (*Redis) Delete

func (r *Redis) Delete(key string) (bool, error)

Delete key from Redis

func (*Redis) Get

func (r *Redis) Get(key string) (farpass.Secret, error)

Get key from Redis

func (*Redis) Put

func (r *Redis) Put(key string, secret farpass.Secret) error

Put key to Redis

func (*Redis) Status

func (r *Redis) Status(key string) (bool, error)

Status returns whether the secret exists and if it is one-time

type Server

type Server struct {
	DB                  Database
	MaxLength           int
	Registry            *prometheus.Registry
	ForceOneTimeSecrets bool
	AssetPath           string
	Logger              *zap.Logger
	TrustedProxies      []string
}

Server struct holding database and settings. This should be created with server.New

func (*Server) HTTPHandler

func (y *Server) HTTPHandler() http.Handler

HTTPHandler containing all routes

Jump to

Keyboard shortcuts

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