rule

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknown = errors.New("undefined proxy rule")
)

Functions

func WithContext

func WithContext(ctx context.Context, rule *Rule) context.Context

Types

type Backend

type Backend struct {
	URL       string `yaml:"url"`
	Namespace string `yaml:"namespace"`
	Prefix    string `yaml:"prefix"`
}

type ConfigRepository

type ConfigRepository interface {
	GetAll(ctx context.Context) ([]Ruleset, error)
}

type Frontend

type Frontend struct {
	URL   string         `yaml:"url"`
	URLRx *regexp.Regexp `yaml:"-"`

	Method string `yaml:"method"`
}

type HookSpec

type HookSpec struct {
	Name   string                 `yaml:"name"`
	Config map[string]interface{} `yaml:"config"`
}

type HookSpecs

type HookSpecs []HookSpec

func (HookSpecs) Get

func (m HookSpecs) Get(name string) (HookSpec, bool)

type MiddlewareSpec

type MiddlewareSpec struct {
	Name   string                 `yaml:"name"`
	Config map[string]interface{} `yaml:"config"`
}

type MiddlewareSpecs

type MiddlewareSpecs []MiddlewareSpec

func (MiddlewareSpecs) Get

func (m MiddlewareSpecs) Get(name string) (MiddlewareSpec, bool)

type Rule

type Rule struct {
	Frontend    Frontend        `yaml:"frontend"`
	Backend     Backend         `yaml:"backend"`
	Middlewares MiddlewareSpecs `yaml:"middlewares"`
	Hooks       HookSpecs       `yaml:"hooks"`
}

func GetFromContext

func GetFromContext(ctx context.Context) (*Rule, bool)

type Ruleset

type Ruleset struct {
	Rules []Rule `yaml:"rules"`
}

type Service

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

func NewService

func NewService(configRepository ConfigRepository) *Service

func (Service) GetAllConfigs

func (s Service) GetAllConfigs(ctx context.Context) ([]Ruleset, error)

Jump to

Keyboard shortcuts

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