proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package proxy ... this file mainly to load from file and set proxy rules

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBalancerNotMatched plugin.Proxy balancer not matched
	ErrBalancerNotMatched = errors.New("plugin.Proxy balancer not matched")
	// ErrPageNotFound can not found page
	ErrPageNotFound = errors.New("404 Page Not Found")
	// ErrNoReverseServer ...
	ErrNoReverseServer = errors.New("could not found reverse proxy")
)
View Source
var (
	// ErrTimeout ...
	ErrTimeout = errors.New("combineReq timeout error")
)

Functions

func GCD

func GCD(a, b int) int

GCD 求最大公约数

Types

type Balancer

type Balancer struct {
	// contains filtered or unexported fields
}

Balancer ...

func NewBalancer

func NewBalancer(servers []ServerCfgInterface) *Balancer

NewBalancer ... 初始化调度器 Notice: https://github.com/golang/go/wiki/InterfaceSlice

func (*Balancer) Distribute

func (bla *Balancer) Distribute() int

Distribute 均衡调度算法调度

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy ...

func New

func New(
	reverseServers map[string][]rule.ReverseServer,
	pathRules []rule.PathRuler,
	srvRules []rule.ServerRuler,
) *Proxy

New ... load configs from outter to generate a new proxy plugin

func (*Proxy) Handle

func (p *Proxy) Handle(c *plugin.Context)

Handle ... proxy to handle with request ... 1. single path 2. all server proxy

type ServerCfgInterface

type ServerCfgInterface interface {
	// W means weight
	W() int
}

ServerCfgInterface ...

Jump to

Keyboard shortcuts

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