Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type AppManager ¶
type AppManager struct { AppMap map[string]*App AppSlice []*App Locker sync.RWMutex // contains filtered or unexported fields }
var AppManagerHandler *AppManager
func NewAppManagerHandler ¶
func NewAppManagerHandler() *AppManager
func (*AppManager) GetAppList ¶
func (a *AppManager) GetAppList() []*App
type LoadBalancer ¶
type LoadBalancer struct { // 当服务多的时候使用map方便,但是需要加锁 LoadBalanceMap map[string]*LoadBalancerItem // 当服务比较少的时候使用 slice 便利,减少锁的开销 LoadBalanceSlice []*LoadBalancerItem Locker sync.RWMutex }
var LoadBalancerHandler *LoadBalancer
func NewLoadBalancer ¶
func NewLoadBalancer() *LoadBalancer
func (*LoadBalancer) GetLoadBalancer ¶
func (lbr *LoadBalancer) GetLoadBalancer(service *ServiceDetail) (loadbalance.LoadBalance, error)
type LoadBalancerItem ¶
type LoadBalancerItem struct { LoadBalance loadbalance.LoadBalance ServiceName string }
type ServiceAccessControl ¶
type ServiceAccessControl struct { ID int64 `db:"id" json:"id"` ServiceID int64 `db:"service_id" json:"service_id"` BlackList string `db:"black_list" json:"black_list"` WhiteList string `db:"white_list" json:"white_list"` WhiteHostName string `db:"white_host_name" json:"white_host_name"` OpenAuth int `db:"open_auth" json:"open_auth"` ClientIPFlowLimit int `db:"clientip_flow_limit" json:"clientip_flow_limit"` ServiceFlowLimit int `db:"service_flow_limit" json:"service_flow_limit"` }
func GetServiceAccessControllerByID ¶
func GetServiceAccessControllerByID(ID int64, c *gin.Context, ) (accessController *ServiceAccessControl, err error)
type ServiceDetail ¶
type ServiceDetail struct { Info *ServiceInfo `json:"info" description:"基本信息"` HTTPRule *ServiceHTTPRule `json:"http_rule" description:"http_rule"` TCPRule *ServiceTCPRule `json:"tcp_rule" description:"tcp_rule"` GRPCRule *ServiceGRPCRule `json:"grpc_rule" description:"grpc_rule"` LoadBalance *ServiceLoadBalance `json:"load_balance" description:"load_balance"` AccessControl *ServiceAccessControl `json:"access_control" description:"access_control"` }
ServiceDetail 查询服务列表 Do
func GetServiceDetail ¶
func GetServiceDetail(serviceInfo *ServiceInfo, c *gin.Context) (detail *ServiceDetail, err error)
type ServiceGRPCRule ¶
type ServiceGRPCRule struct { ID int64 `db:"id" json:"id"` ServiceID int64 `db:"service_id" json:"service_id"` Port int `db:"port" json:"port"` HeaderTransfor string `db:"header_transfor" json:"header_transfor"` }
func GetServiceGRPCRuleByID ¶
func GetServiceGRPCRuleByID(ID int64, c *gin.Context, ) (grpcRule *ServiceGRPCRule, err error)
type ServiceHTTPRule ¶
type ServiceHTTPRule struct { ID int64 `db:"id" json:"id"` ServiceID int64 `db:"service_id" json:"service_id"` RuleType int `db:"rule_type" json:"rule_type"` NeedHTTPs int `db:"need_https" json:"need_https"` NeedStripUri int `db:"need_strip_uri" json:"need_strip_uri"` NeedWebsocket int `db:"need_websocket" json:"need_websocket"` Rule string `db:"rule" json:"rule"` UrlRewrite string `db:"url_rewrite" json:"url_rewrite"` HeaderTransfor string `db:"header_transfor" json:"header_transfor"` }
func GetServiceHTTPRuleByID ¶
func GetServiceHTTPRuleByID(ID int64, c *gin.Context, ) (httpRule *ServiceHTTPRule, err error)
type ServiceInfo ¶
type ServiceInfo struct { ID int64 `db:"id" json:"id"` LoadType int `db:"load_type" json:"load_type"` IsDelete int `db:"is_delete" json:"is_delete"` ServiceName string `db:"service_name" json:"service_name"` ServiceDesc string `db:"service_desc" json:"service_desc"` CreatedAt time.Time `db:"create_at" json:"create_at"'` UpdatedAt time.Time `db:"update_at" json:"update_at"` }
func GetServiceInfoList ¶
type ServiceListInput ¶
ServiceListInput 查询信息 Do
type ServiceLoadBalance ¶
type ServiceLoadBalance struct { ID int64 `db:"id" json:"id"` ServiceID int64 `db:"service_id" json:"service_id"` CheckMethod int `db:"check_method" json:"check_method"` CheckTimeout int `db:"check_timeout" json:"check_timeout"` CheckInterval int `db:"check_interval" json:"check_interval"` RoundType int `db:"round_type" json:"round_type"` IPList string `db:"ip_list" json:"ip_list"` WeightList string `db:"weight_list" json:"weight_list"` ForbidList string `db:"forbid_list" json:"forbid_list"` UpStreamConnectTimeout int `db:"upstream_connect_timeout" json:"upstream_connect_timeout"` UpStreamHeaderTimeout int `db:"upstream_header_timeout" json:"upstream_header_timeout"` UpStreamIdleTimeout int `db:"upstream_idle_timeout" json:"upstream_idle_timeout"` UpStreamMaxIdle int `db:"upstream_max_idle" json:"upstream_max_idle"` }
func GetServiceLoadBalanceByID ¶
func GetServiceLoadBalanceByID(ID int64, c *gin.Context, ) (loadBalance *ServiceLoadBalance, err error)
func (*ServiceLoadBalance) GetIpListByModel ¶
func (l *ServiceLoadBalance) GetIpListByModel() []string
func (*ServiceLoadBalance) GetWeightListByModel ¶
func (l *ServiceLoadBalance) GetWeightListByModel() []string
type ServiceManager ¶
type ServiceManager struct { ServiceMap map[string]*ServiceDetail ServiceSlice []*ServiceDetail Locker sync.RWMutex // 锁 // contains filtered or unexported fields }
var ServiceManagerHandler *ServiceManager
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)
HTTPAccessMode 匹配接入
type ServiceTCPRule ¶
type ServiceTCPRule struct { ID int64 `db:"id" json:"id"` ServiceID int64 `db:"service_id" json:"service_id"` Port int `db:"port" json:"port"` }
func GetServiceTCPRuleByID ¶
func GetServiceTCPRuleByID(ID int64, c *gin.Context, ) (tcpRule *ServiceTCPRule, err error)
type Transport ¶
type Transport struct { TransportMap map[string]*TransportItem TransportSlice []*TransportItem Locker sync.RWMutex }
var TransportHandler *Transport
func NewTransport ¶
func NewTransport() *Transport
func (*Transport) GetTransport ¶
func (t *Transport) GetTransport(service *ServiceDetail) (*http.Transport, error)
type TransportItem ¶
Click to show internal directories.
Click to hide internal directories.