front

package module
v0.1.20231203035145 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 15 Imported by: 0

README

front

这是一个简单的http/https/websocket均衡负载,故障转移路由

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoHttp     = errors.New("ErrNoHttp")
	ErrNoWs       = errors.New("ErrNoWs")
	ErrCopy       = errors.New("ErrCopy")
	ErrReqCreFail = errors.New("ErrReqCreFail")
	ErrReqDoFail  = errors.New("ErrReqDoFail")
	ErrResDoFail  = errors.New("ErrResDoFail")
)

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"`
	ErrBanSec int      `json:"errBanSec"`
	PathAdd   bool     `json:"pathAdd"`
	ReqHeader []Header `json:"reqHeader"`
	ResHeader []Header `json:"resHeader"`
	// contains filtered or unexported fields
}

func (*Back) Disable added in v0.1.20231203025759

func (t *Back) Disable()

func (*Back) IsLive added in v0.1.20231203025759

func (t *Back) IsLive() bool

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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