model

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//ErrInvalidRoles returns when roles is wrong
	ErrInvalidRoles = fmt.Errorf("Invalid roles. Options: %v", roles)
	//ErrInvalidMethod returns when method is wrong
	ErrInvalidMethod = fmt.Errorf("Invalid method. Options: %v", methods)
	//ErrInvalidUpstreamProtocol return when usptream is incorrect
	ErrInvalidUpstreamProtocol = fmt.Errorf("Invalid usptream protocol. Options: %v", upstreamProto)
	//ErrInvalidListen returns when listen path is wrong
	ErrInvalidListen = fmt.Errorf("Invalid listen path.")
)
View Source
var (

	//ErrInvalidRateType returns when Rate type is not correct
	ErrInvalidRateType = fmt.Errorf("Invalid rate type. Options: %v", rateTypes)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Port        int
	HealthCheck struct {
		URLs []tomlURL `toml:"urls"`
	} `toml:"healthcheck"`
	TLS struct {
		Enable
		Key  string `toml:"-"`
		Cert string `toml:"-"`
	}
	Auth struct {
		Enable
	}
	Prometheus struct {
		Enable
		Port int
	}
	Rate struct {
		Enable
		Limit int
		Type  string
	}
	Clickhouse struct {
		Enable
		Crypt bool
	}
}

func (*Config) String added in v1.0.1

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() []error

Validate return array or invalid inputs TODO: Add rate limit validation

type Enable

type Enable bool

type Metrics

type Metrics struct {
	RTotal     prometheus.Collector
	RUserIP    prometheus.Collector
	RRoute     prometheus.Collector
	RUserAgent prometheus.Collector
}

func CreateMetrics

func CreateMetrics() *Metrics

type Route

type Route struct {
	ID       string `toml:"-"`
	Name     string
	Desc     string
	Active   bool
	Roles    []string
	Method   string
	Upstream string
	Listen   string
	Strip    bool
	Group    string
	WS       bool
}

func (*Route) Entry

func (r *Route) Entry() *log.Entry

Entry return logrus entry with route params

type Routes

type Routes struct {
	Routes map[string]Route
}

func (*Routes) Validate

func (rs *Routes) Validate() []error

Validate return array or invalid inputs

Jump to

Keyboard shortcuts

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