config

package
v0.0.0-...-19ea1ac Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRouterConfig

type BaseRouterConfig struct {
	Prefix string `default:"/"`
	// contains filtered or unexported fields
}

func NewBaseRouterConfig

func NewBaseRouterConfig(prefix string) BaseRouterConfig

func (*BaseRouterConfig) EnableCore

func (c *BaseRouterConfig) EnableCore()

func (*BaseRouterConfig) IsNeedCore

func (c *BaseRouterConfig) IsNeedCore() bool

func (*BaseRouterConfig) PathPrefix

func (c *BaseRouterConfig) PathPrefix() string

type Config

type Config struct {
	Host    string
	Port    uint
	Routers RouterConfigSlice
}

func GetConfig

func GetConfig() ([]Config, error)

func NewConfig

func NewConfig(host string, port uint, routers ...RouterConfig) Config

type CoreRouterConfig

type CoreRouterConfig struct {
	BaseRouterConfig
	RouterConfig
	Origins []string
	Headers []string
	Methods []string
}

func (*CoreRouterConfig) Handler

func (c *CoreRouterConfig) Handler() types.Handler

type ProxyRouterConfig

type ProxyRouterConfig struct {
	BaseRouterConfig
	Scheme  string `default:"http"`
	Host    string
	BaseUri string `default:"/"`
}

func NewProxyRouterConfig

func NewProxyRouterConfig(pathPrefix, scheme, host, baseUri string) *ProxyRouterConfig

func NewProxyRouterConfigByUrl

func NewProxyRouterConfigByUrl(pathPrefix, proxyPass string) (*ProxyRouterConfig, error)

func (ProxyRouterConfig) Handler

func (p ProxyRouterConfig) Handler() types.Handler

type RootRouterConfig

type RootRouterConfig struct {
	BaseRouterConfig
	StaticPath string
	IndexPath  []string `default:"[\"index.html\"]"`
}

func NewRootRouterConfig

func NewRootRouterConfig(pathPrefix, staticPath string, indexPath ...string) *RootRouterConfig

func (*RootRouterConfig) Handler

func (c *RootRouterConfig) Handler() types.Handler

type RouterConfig

type RouterConfig interface {
	PathPrefix() string
	EnableCore()
	IsNeedCore() bool
	Handler() types.Handler
}

type RouterConfigSlice

type RouterConfigSlice []RouterConfig

func (RouterConfigSlice) Len

func (r RouterConfigSlice) Len() int

func (RouterConfigSlice) Less

func (r RouterConfigSlice) Less(i, j int) bool

func (RouterConfigSlice) Register

func (r RouterConfigSlice) Register(router *mux.Router)

func (RouterConfigSlice) Swap

func (r RouterConfigSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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