Documentation ¶
Index ¶
- Constants
- Variables
- func AddCity(c *models.City) error
- func AddGroup(g *models.Group) error
- func AddGroupServerRef(ref *models.ServerGroupRef) error
- func AddIdc(i *models.Idc)
- func AddPool(p *models.Pool) error
- func AddPoolGroupRef(ref *models.GroupPoolRef) error
- func AddProvince(p *models.Province) error
- func AddRegion(rg *models.Region) error
- func AddRoute(r *models.Route) error
- func AddServer(ref *models.ServerGroupRef) error
- func AddService(s *models.Service) error
- func DeleteCity(code int) error
- func DeleteGroup(id string)
- func DeleteGroupServerRef(refId string) error
- func DeleteIdc(id string)
- func DeletePool(id string) error
- func DeletePoolGroupRef(refId string) error
- func DeleteProvince(code int) error
- func DeleteRegion(code int) error
- func DeleteRoute(id string) error
- func DeleteService(id string)
- func GetIpInfo(ip net.IP) interface{}
- func If(cond bool, a, b interface{}) interface{}
- func Init(arg Args) error
- func InitRequestContext(c *Context, ipAddr net.IP, params string)
- func InitRoutes(rs ...*route) error
- func IsValidIp(ip string) (int, bool)
- func NewGroup(g *models.Group) (*group, error)
- func NewHealthyCheck(name string, cfg string) (healthyCheckFunc, error)
- func NewPoolSelector(mode int) (poolSelector, error)
- func ParseRules(rules string) ([]*rule, error)
- func ResolveIpsByHost(c *Context, host string, address *Address) error
- func UpdateGroup(groupId string) error
- func UpdatePoolGroup(poolId string) error
- func ValidateHost(host string) error
- type Address
- type Args
- type Balancer
- type Context
- type Daoes
- type GroupStatus
- type Metrics
- type Node
- type RouteSelector
- type Target
- type WeightedLoopBalancer
Constants ¶
View Source
const (
LoopBalancer = "loop"
)
Variables ¶
View Source
var ErrorNoIpFoundInBalancer = fmt.Errorf("no ip found in balancer")
View Source
var (
NoGroupFoundError = errors.New("no available group found")
)
Functions ¶
func AddGroupServerRef ¶
func AddGroupServerRef(ref *models.ServerGroupRef) error
func AddPoolGroupRef ¶
func AddPoolGroupRef(ref *models.GroupPoolRef) error
todo 保证一个server 只会被加到一个pool中一次
func AddProvince ¶
func AddServer ¶
func AddServer(ref *models.ServerGroupRef) error
func AddService ¶
func DeleteCity ¶
func DeleteGroup ¶
func DeleteGroup(id string)
func DeleteGroupServerRef ¶
func DeletePool ¶
func DeletePoolGroupRef ¶
func DeleteProvince ¶
func DeleteRegion ¶
func DeleteRoute ¶
func DeleteService ¶
func DeleteService(id string)
func InitRoutes ¶
func InitRoutes(rs ...*route) error
func NewHealthyCheck ¶
func NewPoolSelector ¶
func UpdateGroup ¶
func UpdatePoolGroup ¶
func ValidateHost ¶
Types ¶
type Context ¶
type Context struct { GetV6 bool Getter func(key string) string Group string Pool string Service string Route string Idc string LbMode int ClientIp net.IP // contains filtered or unexported fields }
func (*Context) IdcAffinity ¶
type Daoes ¶
type Daoes struct { ServiceDao dao.Service //ServerDao dao.Server GroupServerRefDao dao.GroupServerRef GroupDao dao.Group PoolDao dao.Pool GroupPoolRefDao dao.GroupPoolRef RouteDao dao.Route IdcDao dao.Idc City dao.City Province dao.Province Region dao.Region Param dao.ParamsEnums Country dao.Country User dao.User }
type GroupStatus ¶
func GetGroupStatus ¶
func GetGroupStatus() []*GroupStatus
type RouteSelector ¶
type RouteSelector struct {
// contains filtered or unexported fields
}
func NewRouteSelector ¶
func NewRouteSelector() *RouteSelector
type WeightedLoopBalancer ¶
type WeightedLoopBalancer struct {
// contains filtered or unexported fields
}
带权重轮询负载均衡器
func (*WeightedLoopBalancer) Get ¶
func (b *WeightedLoopBalancer) Get(ctx *Context) ([]*Target, error)
func (*WeightedLoopBalancer) Reload ¶
func (b *WeightedLoopBalancer) Reload(tgs []*Target)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.