core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNotFound = errors.New("route not found")

Functions

func MatchPath

func MatchPath(routes []route.Route, path string) (r *route.Route, err error)

Types

type Cache

type Cache struct {
	Host     string `config:"host"`
	Port     int64  `config:"port"`
	Username string `config:"username"`
	Password string `config:"password"`
	DB       int64  `config:"db"`
	Prefix   string `config:"prefix"`
}

type Config

type Config struct {
	Port    int64         `config:"port"`
	Backend route.Backend `config:"backend"`
	//
	Routes []route.Route `config:"routes"`
	//
	Cache Cache `config:"cache"`
	//
	HealthCheck HealthCheck `config:"healthcheck"`
	//
	Match func(path string) (r *route.Route, err error)
}

type Core

type Core interface {
	Version() string
	Run() error
}

func New

func New(version string, cfg *Config) (Core, error)

type HealthCheck

type HealthCheck struct {
	Outer HealthCheckOuter `config:"outer"`
	Inner HealthCheckInner `config:"inner"`
}

type HealthCheckInner

type HealthCheckInner struct {
	Enable bool `config:"enable"`
	//
	Interval int64 `config:"interval"`
	Timeout  int64 `config:"timeout"`
}

type HealthCheckOuter

type HealthCheckOuter struct {
	Enable bool `config:"enable"`
	// Path is the health check request path
	Path string `config:"path"`
	// Ok means all health check request returns ok
	Ok bool `config:"ok"`
}

type Matcher

type Matcher struct {
	Service service.Service
}

type Plugin

type Plugin interface {
	// prepare
	Prepare(app *zoox.Application, cfg *Config) (err error)

	// request
	OnRequest(ctx *zoox.Context, req *http.Request) (err error)

	// response
	OnResponse(ctx *zoox.Context, res http.ResponseWriter) (err error)
}

type SSL

type SSL struct {
	Domain string  `config:"domain"`
	Cert   SSLCert `config:"cert"`
}

type SSLCert

type SSLCert struct {
	Certificate    string `config:"certificate"`
	CertificateKey string `config:"certificate_key"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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