backend

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Url          *url.URL
	Host         string
	ReverseProxy *httputil.ReverseProxy
}

type BackendPool

type BackendPool struct {
	Backends []*Backend // 所有节点
	Current  uint64     // 当前轮到的节点索引
	Port     string     // 本地端口
	BackUp   *Backend   // 备用
	TlsCert  string     // cert.pem 路径
	TlsKey   string     // key.pem 路径
}

func (*BackendPool) GetNextPeer

func (p *BackendPool) GetNextPeer(alive *IsAlive) (*Backend, int64)

func (*BackendPool) NextIndex

func (p *BackendPool) NextIndex() int

type IsAlive

type IsAlive struct {
	M       sync.Map // map[host]rtt
	TimeOut int64
}

func (*IsAlive) GetStatus

func (i *IsAlive) GetStatus(url string) (int64, bool)

func (*IsAlive) HealthCheck

func (i *IsAlive) HealthCheck()

func (*IsAlive) SetStatus

func (i *IsAlive) SetStatus(url string, status int64)

Jump to

Keyboard shortcuts

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