Versions in this module Expand all Collapse all v1 v1.0.0 Oct 29, 2021 Changes in this version + const DataTypeHour + const DataTypeMinute + const DataTypeSecond + func CleanupLimiters() + func RedisScript(script string, args ...interface{}) (interface{}, error) + func ServiceManagerInit() + type AppEvent struct + AddApp []*model.App + DeleteApp []*model.App + UpdateApp []*model.App + type AppManager struct + AppMap map[string]*model.App + AppSlice []*model.App + Observers map[AppObserver]bool + UpdateAt time.Time + var AppManagerHandler *AppManager + func NewAppManager() *AppManager + func (s *AppManager) Deregist(ob AppObserver) + func (s *AppManager) GetAppList() []*model.App + func (s *AppManager) LoadAndWatch() error + func (s *AppManager) LoadApp() *AppManager + func (s *AppManager) Notify(e *AppEvent) + func (s *AppManager) Regist(ob AppObserver) + type AppObserver interface + Update func(*AppEvent) + type AppSubject interface + Deregist func(ServiceObserver) + Notify func(*AppEvent) + Regist func(ServiceObserver) + type DistributedCountService struct + Interval time.Duration + Name string + QPS int64 + TickerCount int64 + TotalCount int64 + Unix int64 + func NewDistributedCountService(name string, interval time.Duration) *DistributedCountService + func (o *DistributedCountService) Close() + func (o *DistributedCountService) GetDayData(t time.Time) (int64, error) + func (o *DistributedCountService) GetDayKey(t time.Time) string + func (o *DistributedCountService) GetHourData(t time.Time) (int64, error) + func (o *DistributedCountService) GetHourKey(t time.Time) string + func (o *DistributedCountService) Increase() + type DistributedLimiter struct + Capacity int64 + Dtype int + Name string + Rate int64 + func NewDistributedLimiter(name string, dtype int, rate, capacity int64) *DistributedLimiter + func (d *DistributedLimiter) Allow() bool + func (d *DistributedLimiter) AllowV1() bool + type FlowAppCounter struct + var AppCounterHandler *FlowAppCounter + func NewFlowAppCounter() *FlowAppCounter + func (counter *FlowAppCounter) Update(e *AppEvent) + type FlowCounter struct + Locker sync.RWMutex + RedisFlowCountMap map[string]*DistributedCountService + var ServiceCounterHandler *FlowCounter + func NewFlowCounter() *FlowCounter + func (counter *FlowCounter) GetCounter(name string) (*DistributedCountService, error) + func (counter *FlowCounter) Update(e *ServiceEvent) + type FlowLimiter struct + FlowLimiterMap map[string]*FlowLimiterItem + Locker sync.RWMutex + var FlowLimiterHandler *FlowLimiter + func NewFlowLimiter() *FlowLimiter + func (counter *FlowLimiter) GetLimiter(serverName string, val float64, ltype int, isDistributed bool) (Limiter, error) + type FlowLimiterItem struct + IsDistributed bool + LType int + LastTime time.Time + Limter Limiter + Name string + type Limiter interface + Allow func() bool + type LoadBalancer struct + LoadBanlanceMap map[string]*LoadBalancerItem + LoadBanlanceSlice []*LoadBalancerItem + Locker sync.RWMutex + var LoadBalancerHandler *LoadBalancer + func NewLoadBalancer() *LoadBalancer + func (lbr *LoadBalancer) GetLoadBalancer(service *model.ServiceDetail) (*load_balance.LoadBalance, error) + func (lbr *LoadBalancer) Update(e *ServiceEvent) + type LoadBalancerItem struct + LoadBanlance *load_balance.LoadBalance + ServiceName string + UpdatedAt time.Time + type ServiceEvent struct + AddService []*model.ServiceDetail + DeleteService []*model.ServiceDetail + UpdateService []*model.ServiceDetail + type ServiceManager struct + Observers map[ServiceObserver]bool + ServiceMap map[string]*model.ServiceDetail + ServiceSlice []*model.ServiceDetail + UpdateAt time.Time + var ServiceManagerHandler *ServiceManager = NewServiceManager() + func NewServiceManager() *ServiceManager + func (s *ServiceManager) Deregist(ob ServiceObserver) + func (s *ServiceManager) GetGrpcServiceList() []*model.ServiceDetail + func (s *ServiceManager) GetTcpServiceList() []*model.ServiceDetail + func (s *ServiceManager) HTTPAccessMode(c *gin.Context) (*model.ServiceDetail, error) + func (s *ServiceManager) Load() error + func (s *ServiceManager) LoadAndWatch() error + func (s *ServiceManager) LoadService() *ServiceManager + func (s *ServiceManager) Notify(e *ServiceEvent) + func (s *ServiceManager) Regist(ob ServiceObserver) + type ServiceObserver interface + Update func(*ServiceEvent) + type ServiceSubject interface + Deregist func(ServiceObserver) + Notify func(*ServiceEvent) + Regist func(ServiceObserver) + type TransportItem struct + ServiceName string + Trans *http.Transport + UpdateAt time.Time + type Transportor struct + Locker sync.RWMutex + TransportMap map[string]*TransportItem + TransportSlice []*TransportItem + var TransportorHandler *Transportor + func NewTransportor() *Transportor + func (t *Transportor) GetTrans(service *model.ServiceDetail) (*http.Transport, error) + func (t *Transportor) Update(e *ServiceEvent)