server

package module
v0.0.0-...-f7a2d95 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.0.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RootDomain     string                  `mapstructure:"root_domain"`
	APIHost        string                  `mapstructure:"api_host"`
	APIListenHTTP  string                  `mapstructure:"api_listen_http"`
	APIListenHTTPS string                  `mapstructure:"api_listen_https"`
	APIBehindProxy bool                    `mapstructure:"api_behind_proxy"`
	CertFile       string                  `mapstructure:"tls_cert"`
	KeyFile        string                  `mapstructure:"tls_key"`
	ACMEEnabled    bool                    `mapstructure:"acme_enabled"`
	ACMEContact    string                  `mapstructure:"acme_contact"`
	StaticRecords  map[string]StaticRecord `mapstructure:"static_records"`
	TokenKey       string                  `mapstructure:"token_key"`
	Store          string                  `mapstructure:"store"`
	RedisAddr      string                  `mapstructure:"redis_addr"`
	RedisUser      string                  `mapstructure:"redis_user"`
	RedisPass      string                  `mapstructure:"redis_pass"`
	RedisDB        int                     `mapstructure:"redis_db"`
}

type MemStore

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

func NewMemStore

func NewMemStore(logger *zap.SugaredLogger) (*MemStore, error)

func (*MemStore) AutoCleanup

func (s *MemStore) AutoCleanup()

func (*MemStore) Clean

func (s *MemStore) Clean()

func (*MemStore) GetACMEChallengeTokens

func (s *MemStore) GetACMEChallengeTokens(_ context.Context, id uuid.UUID) ([]string, error)

func (*MemStore) IncrementStat

func (s *MemStore) IncrementStat(_ context.Context, key string, value int64)

func (*MemStore) SetACMEChallengeTokens

func (s *MemStore) SetACMEChallengeTokens(_ context.Context, id uuid.UUID, tokens []string) error

type RedisStore

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

func NewRedisStore

func NewRedisStore(cfg Config) *RedisStore

func (*RedisStore) GetACMEChallengeTokens

func (s *RedisStore) GetACMEChallengeTokens(ctx context.Context, id uuid.UUID) ([]string, error)

func (*RedisStore) IncrementStat

func (s *RedisStore) IncrementStat(_ context.Context, _ string, _ int64)

func (*RedisStore) SetACMEChallengeTokens

func (s *RedisStore) SetACMEChallengeTokens(ctx context.Context, id uuid.UUID, tokens []string) error

type Server

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

func New

func New(logger *zap.SugaredLogger, cfg Config, store Store) *Server

func (*Server) ServeDNS

func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

func (*Server) Start

func (s *Server) Start() error

type StaticRecord

type StaticRecord struct {
	A []string
}

type Store

type Store interface {
	SetACMEChallengeTokens(ctx context.Context, id uuid.UUID, tokens []string) error

	GetACMEChallengeTokens(ctx context.Context, id uuid.UUID) ([]string, error)

	IncrementStat(ctx context.Context, key string, value int64)
}

Directories

Path Synopsis
internal
v1
Package v1 provides primitives to interact with the openapi HTTP API.
Package v1 provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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