Documentation ¶
Overview ¶
Package shunt 负载服务包
Index ¶
- Constants
- func GetService(serviceName string) (service *server.Service, err error)
- func Route(engine *gin.Engine)
- func RunHash(serviceName string) (add *server.Service, err error)
- func RunRandom(serviceName string) (add *server.Service, err error)
- func RunRound(serviceName string) (service *server.Service, err error)
- func RunShunt(context *gin.Context, serviceName string)
- func RunShuntCallback(context *gin.Context, serviceName string, f func() *response.Result)
- func YamlLBs(data []byte)
- type LB
- type LBs
- type RoundRobinBalance
- type Shunt
Constants ¶
View Source
const ( // Random 负载均衡 random 策略 Random = iota // Round 负载均衡 round 策略 Round // Hash 负载均衡 hash 策略 Hash )
Variables ¶
This section is empty.
Functions ¶
func GetService ¶
GetService 根据服务名称获取待转发服务
func RunShuntCallback ¶
RunShuntCallback 开启路由并处理降级
Types ¶
type LB ¶
type LB struct { Name string `yaml:"Name"` // 服务名称 InURI string `yaml:"InURI"` // 负载入口 URI OutRemote string `yaml:"OutRemote"` // 负载出口地址 Register int `yaml:"Register"` // 负载均衡算法,1:随机;2:轮询;3:Hash一致性 }
LB 负载均衡配置对象
type RoundRobinBalance ¶
type RoundRobinBalance struct {
// contains filtered or unexported fields
}
RoundRobinBalance 负载均衡 round 策略实体
Click to show internal directories.
Click to hide internal directories.