config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHit

func CheckHit(list CheckList, tpl *template.Template) (bool, error)

CheckHit check args

Types

type CheckList

type CheckList map[string][]string

CheckList key list

type Config

type Config struct {
	Name string `json:"name"`
	// listen 绑定端口
	Listen      string     `json:"listen"`
	MaxBodySize string     `json:"max_body_size"`
	Middleware  Middleware `json:"middleware"`
	// Handler Handler
	Handler []*Handler `json:"handler"`
	Log     struct {
		Path string `json:"path"`
	} `json:"log"`
	Logger log.Logger `json:"-" yaml:"-"`
}

Config 配置

func (*Config) ReadFile

func (p *Config) ReadFile(filename string) error

ReadFile 读取配置文件

type Handler

type Handler struct {
	Host       []string   `json:"host"`
	Middleware Middleware `json:"middleware"`
	Router     []*Router  `json:"router"`
}

type Middleware

type Middleware []Plugin

func (Middleware) Load

type Plugin

type Plugin map[string]interface{}

func (*Plugin) Load

func (p *Plugin) Load(c *middleware.Config) (middleware.Plugin, error)

type Router

type Router struct {
	Paths      []string   `json:"paths"`
	Middleware Middleware `json:"middleware"`
	Handler    Plugin     `json:"handler"`
}

Jump to

Keyboard shortcuts

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