Documentation ¶
Index ¶
- type AccessControl
- func (t *AccessControl) Find(c *gin.Context, tx *gorm.DB, search *AccessControl) (*AccessControl, error)
- func (t *AccessControl) ListBYServiceID(c *gin.Context, tx *gorm.DB, serviceID int64) ([]AccessControl, int64, error)
- func (t *AccessControl) Save(c *gin.Context, tx *gorm.DB) error
- func (t *AccessControl) TableName() string
- type Admin
- type App
- type AppEvent
- type AppManager
- type AppObserver
- type AppSubject
- type GrpcRule
- type HttpRule
- type LoadBalance
- func (t *LoadBalance) Find(c *gin.Context, tx *gorm.DB, search *LoadBalance) (*LoadBalance, error)
- func (t *LoadBalance) GetIPListByModel() []string
- func (t *LoadBalance) GetWeightListByModel() []string
- func (t *LoadBalance) Save(c *gin.Context, tx *gorm.DB) error
- func (t *LoadBalance) TableName() string
- type LoadBalancer
- type LoadBalancerItem
- type ServiceDetail
- type ServiceEvent
- type ServiceInfo
- func (a *ServiceInfo) Find(c *gin.Context, tx *gorm.DB, search *ServiceInfo) (*ServiceInfo, error)
- func (s *ServiceInfo) GroupByLoadType(c *gin.Context, tx *gorm.DB) ([]dto.DashServiceStatItemOutput, error)
- func (s *ServiceInfo) PageList(c *gin.Context, tx *gorm.DB, param *dto.ServiceInfoInput) ([]ServiceInfo, int64, error)
- func (a *ServiceInfo) Save(c *gin.Context, tx *gorm.DB) error
- func (t *ServiceInfo) ServiceDetail(c *gin.Context, tx *gorm.DB, search *ServiceInfo) (*ServiceDetail, error)
- func (t *ServiceInfo) TableName() string
- type ServiceManager
- func (s *ServiceManager) Deregister(ob ServiceObserver)
- func (s *ServiceManager) GetGrpcServiceList() []*ServiceDetail
- func (s *ServiceManager) GetTcpServiceList() []*ServiceDetail
- func (s *ServiceManager) HttpAccessMode(c *gin.Context) (*ServiceDetail, error)
- func (s *ServiceManager) LoadAndWatch() error
- func (s *ServiceManager) LoadService() *ServiceManager
- func (s *ServiceManager) Notify(e *ServiceEvent)
- func (s *ServiceManager) Register(ob ServiceObserver)
- type ServiceObserver
- type ServiceSubject
- type TcpRule
- type TransportItem
- type Transportor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControl ¶
type AccessControl struct { ID int64 `json:"id" gorm:"primary_key"` ServiceID int64 `json:"service_id" gorm:"column:service_id" description:"服务id"` OpenAuth int `json:"open_auth" gorm:"column:open_auth" description:"是否开启权限 1=开启"` BlackList string `json:"black_list" gorm:"column:black_list" description:"黑名单ip "` WhiteList string `json:"white_list" gorm:"column:white_list" description:"白名单ip "` WhiteHostName string `json:"white_host_name" gorm:"column:white_host_name" description:"白名单主机 "` ClientIPFlowLimit int `json:"clientip_flow_limit" gorm:"column:clientip_flow_limit" description:"�客户端ip限流 "` ServiceFlowLimit int `json:"service_flow_limit" gorm:"column:service_flow_limit" description:"服务端限流 "` }
func (*AccessControl) Find ¶
func (t *AccessControl) Find(c *gin.Context, tx *gorm.DB, search *AccessControl) (*AccessControl, error)
func (*AccessControl) ListBYServiceID ¶
func (t *AccessControl) ListBYServiceID(c *gin.Context, tx *gorm.DB, serviceID int64) ([]AccessControl, int64, error)
func (*AccessControl) TableName ¶
func (t *AccessControl) TableName() string
type Admin ¶
type Admin struct { Id int `json:"id" gorm:"primary_key" description:"自增主键"` UserName string `json:"user_name" gorm:"column:user_name" description:"管理员用户名"` Password string `json:"password" gorm:"column:password" description:"密码"` Salt string `json:"salt" gorm:"column:salt" description:"盐"` UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"` CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"` IsDelete int `json:"is_delete" gorm:"column:is_delete" description:"是否删除"` }
func (*Admin) LoginCheck ¶
type App ¶
type App struct { ID int64 `json:"id" gorm:"primary_key"` AppID string `json:"app_id" gorm:"column:app_id" description:"�租户id "` Name string `json:"name" gorm:"column:name" description:"租户名称 "` Secret string `json:"secret" gorm:"column:secret" description:"密钥"` WhiteIPS string `json:"white_ips" gorm:"column:white_ips" description:"ip白名单,支持前缀匹配"` Qpd int64 `json:"qpd" gorm:"column:qpd" description:"日请求量限制"` Qps int64 `json:"qps" gorm:"column:qps" description:"每秒请求量限制"` CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"添加时间 "` UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"` IsDelete int8 `json:"is_delete" gorm:"column:is_delete" description:"是否已删除;0:否;1:是"` }
type AppManager ¶
type AppManager struct { AppMap map[string]*App AppSlice []*App UpdateAt time.Time Observers map[AppObserver]bool // contains filtered or unexported fields }
var AppManagerHandler *AppManager
func NewAppManager ¶
func NewAppManager() *AppManager
func (*AppManager) Deregister ¶
func (s *AppManager) Deregister(ob AppObserver)
func (*AppManager) GetAppList ¶
func (s *AppManager) GetAppList() []*App
func (*AppManager) LoadApp ¶
func (s *AppManager) LoadApp() *AppManager
func (*AppManager) Notify ¶
func (s *AppManager) Notify(e *AppEvent)
func (*AppManager) Register ¶
func (s *AppManager) Register(ob AppObserver)
type AppSubject ¶
type AppSubject interface { Register(ServiceObserver) Deregister(ServiceObserver) Notify(*AppEvent) }
AppSubject 被观察者接口
type GrpcRule ¶
type GrpcRule struct { ID int64 `json:"id" gorm:"primary_key"` ServiceID int64 `json:"service_id" gorm:"column:service_id" description:"服务id "` Port int `json:"port" gorm:"column:port" description:"端口 "` HeaderTransfor string `` /* 156-byte string literal not displayed */ }
func (*GrpcRule) ListByServiceID ¶
type HttpRule ¶
type HttpRule struct { ID int64 `json:"id" gorm:"primary_key"` ServiceID int64 `json:"service_id" gorm:"column:service_id" description:"服务id"` RuleType int `json:"rule_type" gorm:"column:rule_type" description:"匹配类型 domain=域名, url_prefix=url前缀"` Rule string `json:"rule" gorm:"column:rule" description:"type=domain表示域名,type=url_prefix时表示url前缀"` NeedHttps int `json:"need_https" gorm:"column:need_https" description:"type=支持https 1=支持"` NeedWebsocket int `json:"need_websocket" gorm:"column:need_websocket" description:"启用websocket 1=启用"` NeedStripUri int `json:"need_strip_uri" gorm:"column:need_strip_uri" description:"启用strip_uri 1=启用"` UrlRewrite string `json:"url_rewrite" gorm:"column:url_rewrite" description:"url重写功能,每行一个 "` HeaderTransfor string `` /* 157-byte string literal not displayed */ }
func (*HttpRule) ListByServiceID ¶
type LoadBalance ¶
type LoadBalance struct { ID int64 `json:"id" gorm:"primary_key"` ServiceID int64 `json:"service_id" gorm:"column:service_id" description:"服务id "` CheckMethod int `json:"check_method" gorm:"column:check_method" description:"检查方法 tcpchk=检测端口是否握手成功 "` CheckTimeout int `json:"check_timeout" gorm:"column:check_timeout" description:"check超时时间 "` CheckInterval int `json:"check_interval" gorm:"column:check_interval" description:"检查间隔, 单位s "` RoundType int `json:"round_type" gorm:"column:round_type" description:"轮询方式 round/weight_round/random/ip_hash"` IpList string `json:"ip_list" gorm:"column:ip_list" description:"ip列表"` WeightList string `json:"weight_list" gorm:"column:weight_list" description:"�权重列表"` ForbidList string `json:"forbid_list" gorm:"column:forbid_list" description:"禁用ip列表"` UpstreamConnectTimeout int `json:"upstream_connect_timeout" gorm:"column:upstream_connect_timeout" description:"下游建立连接超时, 单位s"` UpstreamHeaderTimeout int `json:"upstream_header_timeout" gorm:"column:upstream_header_timeout" description:"下游获取header超时, 单位s "` UpstreamIdleTimeout int `json:"upstream_idle_timeout" gorm:"column:upstream_idle_timeout" description:"下游链接最大空闲时间, 单位s "` UpstreamMaxIdle int `json:"upstream_max_idle" gorm:"column:upstream_max_idle" description:"下游最大空闲链接数"` }
func (*LoadBalance) Find ¶
func (t *LoadBalance) Find(c *gin.Context, tx *gorm.DB, search *LoadBalance) (*LoadBalance, error)
func (*LoadBalance) GetIPListByModel ¶
func (t *LoadBalance) GetIPListByModel() []string
func (*LoadBalance) GetWeightListByModel ¶
func (t *LoadBalance) GetWeightListByModel() []string
func (*LoadBalance) TableName ¶
func (t *LoadBalance) TableName() string
type LoadBalancer ¶
type LoadBalancer struct { LoadBalanceMap map[string]*LoadBalancerItem LoadBalanceSlice []*LoadBalancerItem Locker sync.RWMutex }
var LoadBalancerHandler *LoadBalancer
func NewLoadBalancer ¶
func NewLoadBalancer() *LoadBalancer
func (*LoadBalancer) GetLoadBalancer ¶
func (lbr *LoadBalancer) GetLoadBalancer(service *ServiceDetail) (load_balance.LoadBalance, error)
func (*LoadBalancer) Update ¶
func (lbr *LoadBalancer) Update(e *ServiceEvent)
type LoadBalancerItem ¶
type LoadBalancerItem struct { LoadBalance load_balance.LoadBalance ServiceName string UpdatedAt time.Time }
type ServiceDetail ¶
type ServiceDetail struct { Info *ServiceInfo `json:"info" description:"基本信息"` HTTPRule *HttpRule `json:"http_rule" description:"http_rule"` TCPRule *TcpRule `json:"tcp_rule" description:"tcp_rule"` GRPCRule *GrpcRule `json:"grpc_rule" description:"grpc_rule"` LoadBalance *LoadBalance `json:"load_balance" description:"load_balance"` AccessControl *AccessControl `json:"access_control" description:"access_control"` }
type ServiceEvent ¶
type ServiceEvent struct { DeleteService []*ServiceDetail AddService []*ServiceDetail UpdateService []*ServiceDetail }
ServiceEvent 通知事件
type ServiceInfo ¶
type ServiceInfo struct { ID int64 `json:"id" gorm:"primary_key" description:"自增主键"` LoadType int `json:"load_type" gorm:"column:load_type" description:"负载类型"` ServiceName string `json:"service_name" gorm:"column:service_name" description:"服务名称"` ServiceDesc string `json:"service_desc" gorm:"column:service_desc" description:"服务描述"` UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"` CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"` IsDelete int `json:"is_delete" gorm:"column:is_delete" description:"是否删除"` }
func (*ServiceInfo) Find ¶
func (a *ServiceInfo) Find(c *gin.Context, tx *gorm.DB, search *ServiceInfo) (*ServiceInfo, error)
func (*ServiceInfo) GroupByLoadType ¶
func (s *ServiceInfo) GroupByLoadType(c *gin.Context, tx *gorm.DB) ([]dto.DashServiceStatItemOutput, error)
func (*ServiceInfo) PageList ¶
func (s *ServiceInfo) PageList(c *gin.Context, tx *gorm.DB, param *dto.ServiceInfoInput) ([]ServiceInfo, int64, error)
func (*ServiceInfo) ServiceDetail ¶
func (t *ServiceInfo) ServiceDetail(c *gin.Context, tx *gorm.DB, search *ServiceInfo) (*ServiceDetail, error)
func (*ServiceInfo) TableName ¶
func (t *ServiceInfo) TableName() string
type ServiceManager ¶
type ServiceManager struct { ServiceMap map[string]*ServiceDetail ServiceSlice []*ServiceDetail UpdateAt time.Time Observers map[ServiceObserver]bool // contains filtered or unexported fields }
var ServiceManagerHandler *ServiceManager
func NewServiceManager ¶
func NewServiceManager() *ServiceManager
func (*ServiceManager) Deregister ¶
func (s *ServiceManager) Deregister(ob ServiceObserver)
func (*ServiceManager) GetGrpcServiceList ¶
func (s *ServiceManager) GetGrpcServiceList() []*ServiceDetail
func (*ServiceManager) GetTcpServiceList ¶
func (s *ServiceManager) GetTcpServiceList() []*ServiceDetail
func (*ServiceManager) HttpAccessMode ¶
func (s *ServiceManager) HttpAccessMode(c *gin.Context) (*ServiceDetail, error)
func (*ServiceManager) LoadAndWatch ¶
func (s *ServiceManager) LoadAndWatch() error
LoadAndWatch 动态更新API配置
func (*ServiceManager) LoadService ¶
func (s *ServiceManager) LoadService() *ServiceManager
func (*ServiceManager) Notify ¶
func (s *ServiceManager) Notify(e *ServiceEvent)
func (*ServiceManager) Register ¶
func (s *ServiceManager) Register(ob ServiceObserver)
type ServiceObserver ¶
type ServiceObserver interface {
Update(*ServiceEvent)
}
ServiceObserver 观察者接口
type ServiceSubject ¶
type ServiceSubject interface { Register(ServiceObserver) Deregister(ServiceObserver) Notify(*ServiceEvent) }
ServiceSubject 被观察者接口
type TcpRule ¶
type TcpRule struct { ID int64 `json:"id" gorm:"primary_key"` ServiceID int64 `json:"service_id" gorm:"column:service_id" description:"服务id "` Port int `json:"port" gorm:"column:port" description:"端口 "` }
func (*TcpRule) ListByServiceID ¶
type TransportItem ¶
type Transportor ¶
type Transportor struct { TransportMap map[string]*TransportItem TransportSlice []*TransportItem Locker sync.Locker }
var TransportorHandler *Transportor
func NewTransportor ¶
func NewTransportor() *Transportor
func (*Transportor) GetTransportor ¶
func (t *Transportor) GetTransportor(service *ServiceDetail) (*http.Transport, error)
func (*Transportor) Update ¶
func (t *Transportor) Update(e *ServiceEvent)
Click to show internal directories.
Click to hide internal directories.