front

package module
v0.1.20231202190621 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 20 Imported by: 0

README

front

这是一个简单的http/https/websocket均衡负载路由

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPeriod

func LoadPeriod(ctx context.Context, buf []byte, configF *pfile.File, configS *Config, logger *plog.Log_interface)

定时加载

func Run

func Run(ctx context.Context, configSP *Config, logger *plog.Log_interface)

转发

func Test

func Test(ctx context.Context, port int, logger *plog.Log_interface)

测试

Types

type Back

type Back struct {
	Name      string   `json:"name"`
	To        string   `json:"to"`
	Weight    int      `json:"weight"`
	PathAdd   bool     `json:"pathAdd"`
	ReqHeader []Header `json:"reqHeader"`
	ResHeader []Header `json:"resHeader"`
}

type Config

type Config struct {
	Addr      string  `json:"addr"`
	MatchRule string  `json:"matchRule"`
	Routes    []Route `json:"routes"`
	// contains filtered or unexported fields
}
type Header struct {
	Action string `json:"action"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

type Route

type Route struct {
	Path string `json:"path"`
	Sign string `json:"-"`
	Back []Back `json:"back"`
}

func (*Route) GenBack

func (t *Route) GenBack() []*Back

func (*Route) SwapSign

func (t *Route) SwapSign() bool

Jump to

Keyboard shortcuts

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