server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

Types

type ClaimLicenseResponse

type ClaimLicenseResponse struct {
	LicenseFile []byte `json:"license_file"`
	LicenseKey  string `json:"license_key"`
}

type Config

type Config struct {
	ServerAddr       string
	ServerPort       int
	EnabledHeartbeat bool
	TTL              time.Duration
	Strategy         StrategyType
	CullInterval     time.Duration
}

func NewConfig

func NewConfig() *Config

type Handler

type Handler interface {
	RegisterRoutes(r *mux.Router)
}

func NewHandler

func NewHandler(m licenses.Manager) Handler

type Reaper

type Reaper interface {
	Start(ctx context.Context) error
	Manager() licenses.Manager
	Config() *Config
}

func NewReaper

func NewReaper(c *Config, m licenses.Manager) Reaper

type RequestBodyPayload

type RequestBodyPayload struct {
	Fingerprint string `json:"fingerprint"`
}

type Server

type Server interface {
	Run() error
	Mount(r *mux.Router)
	Config() *Config
	Manager() licenses.Manager
	Reaper() Reaper
}

func New

func New(c *Config, m licenses.Manager) Server

type StrategyType

type StrategyType string
const (
	LIFO      StrategyType = "lifo"
	FIFO      StrategyType = "fifo"
	RandOrder StrategyType = "rand"
)

func (*StrategyType) Set

func (e *StrategyType) Set(v string) error

func (*StrategyType) String

func (e *StrategyType) String() string

func (*StrategyType) Type

func (e *StrategyType) Type() string

Jump to

Keyboard shortcuts

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