server

package
v0.0.0-...-c5db528 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 17 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(ctx context.Context, key string) (yopass.Secret, error)
	Put(ctx context.Context, key string, secret yopass.Secret) error
	Delete(ctx context.Context, key string) error
}

Database interface

func NewMemcached

func NewMemcached(server string) Database

NewMemcached returns a new memcached database client

func NewRedis

func NewRedis(url string, password 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(ctx context.Context, key string) error

Delete key from memcached

func (*Memcached) Get

func (m *Memcached) Get(ctx context.Context, key string) (yopass.Secret, error)

Get key in memcached

func (*Memcached) Put

func (m *Memcached) Put(ctx context.Context, key string, secret yopass.Secret) error

Put key in Memcached

type Redis

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

Redis client

func (*Redis) Delete

func (r *Redis) Delete(ctx context.Context, key string) error

Delete key from Redis

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, key string) (yopass.Secret, error)

Get key from Redis

func (*Redis) Put

func (r *Redis) Put(ctx context.Context, key string, secret yopass.Secret) error

Put key to Redis

type Server

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

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

func New

func New(db Database, maxLength int, r *prometheus.Registry, forceOneTimeSecrets bool) Server

New is the main way of creating the server.

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