rule

package
v0.0.0-...-55ea77c Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claim

type Claim struct {
	Host    string  `yaml:"host"`
	Path    string  `yaml:"path"`
	Method  string  `yaml:"method"`
	Headers Headers `yaml:"headers"`
}

Claim is claim structure for rules

func (*Claim) ContainsByHeaders

func (c *Claim) ContainsByHeaders(hs Headers) bool

ContainsByHeaders verify if contains A in B as (map[string]string)

type ErrCannotReadRulesFile

type ErrCannotReadRulesFile struct {
	Reason error
}

ErrCannotReadRulesFile to report error when cannot read a rules config file

func (*ErrCannotReadRulesFile) Error

func (e *ErrCannotReadRulesFile) Error() string

type ErrInvalidRulesFile

type ErrInvalidRulesFile struct {
	Reason error
}

ErrInvalidRulesFile to report error when the rules config file is invalid

func (*ErrInvalidRulesFile) Error

func (e *ErrInvalidRulesFile) Error() string

type ErrRuleNotFound

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

ErrRuleNotFound is an structure to response not found error

func (*ErrRuleNotFound) Error

func (e *ErrRuleNotFound) Error() string

type Headers

type Headers map[string]string

Headers alias type for map[string]string

type Rule

type Rule struct {
	Name         string  `yaml:"name"`
	URL          string  `yaml:"url"`
	AbsolutePath bool    `yaml:"absolute_path"`
	Timeout      int64   `yaml:"timeout"`
	Claims       []Claim `yaml:"claims"`
}

Rule is structure that contains parameters to proxy

func (Rule) MatchByClaim

func (r Rule) MatchByClaim(c *Claim) bool

MatchByClaim match by rule claim

type Rules

type Rules []Rule

Rules is alias to []Rule

func Config

func Config(path string) (Rules, error)

Config get rules from config file

func (Rules) Proxy

func (rls Rules) Proxy(verbose bool) http.HandlerFunc

Proxy is handle for rule proxy

Jump to

Keyboard shortcuts

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