Documentation ¶
Index ¶
- Variables
- func SetCircuitBreaker(set ISetCircuitBreaker, cnf conf.IServerConf) (enable bool, err error)
- func SetHosts(set ISetHosts, cnf conf.IServerConf) (enable bool, err error)
- func SetHttpRouters(engine servers.IRegistryEngine, set ISetRouterHandler, cnf conf.IServerConf) (enable bool, err error)
- func SetJWT(set ISetJwtAuth, cnf conf.IServerConf) (enable bool, err error)
- func SetMetric(set ISetMetric, cnf conf.IServerConf) (enable bool, err error)
- func SetStatic(set ISetStatic, cnf conf.IServerConf) (enable bool, err error)
- type Handler
- type IServer
- type ISetCircuitBreaker
- type ISetHosts
- type ISetJwtAuth
- type ISetMetric
- type ISetRouterHandler
- type ISetStatic
- type Option
- func WithLogger(logger *logger.Logger) Option
- func WithMetric(host string, dataBase string, userName string, password string, cron string) Option
- func WithName(platName string, systemName string, clusterName string, serverType string) Option
- func WithShowTrace(b bool) Option
- func WithTimeout(readTimeout int, writeTimeout int, readHeaderTimeout int) Option
- type Routers
- type WSServer
- func (s *WSServer) CloseCircuitBreaker() error
- func (s *WSServer) GetAddress() string
- func (s *WSServer) GetStatus() string
- func (s *WSServer) Run() error
- func (s *WSServer) SetCircuitBreaker(c *conf.CircuitBreaker) error
- func (s *WSServer) SetHosts(hosts conf.Hosts) error
- func (s *WSServer) SetJWT(auth *conf.JWTAuth) error
- func (s *WSServer) SetMetric(metric *conf.Metric) error
- func (s *WSServer) SetRouters(routers []*conf.Router) (err error)
- func (s *WSServer) SetStatic(static *conf.Static) error
- func (s *WSServer) SetTrace(b bool)
- func (s *WSServer) Shutdown(timeout time.Duration)
- func (s *WSServer) StopMetric() error
- type WSServerResponsiveServer
- func (w *WSServerResponsiveServer) GetAddress() string
- func (w *WSServerResponsiveServer) GetServices() map[string][]string
- func (w *WSServerResponsiveServer) GetStatus() string
- func (w *WSServerResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
- func (w *WSServerResponsiveServer) Notify(conf conf.IServerConf) error
- func (w *WSServerResponsiveServer) Restart(cnf conf.IServerConf) (err error)
- func (w *WSServerResponsiveServer) Restarted() bool
- func (w *WSServerResponsiveServer) SetConf(restart bool, cnf conf.IServerConf) (err error)
- func (w *WSServerResponsiveServer) Shutdown()
- func (w *WSServerResponsiveServer) Start() (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRootPrivileges = errors.New("You must have root user privileges. Possibly using 'sudo' command should help")
View Source
var ErrUnsupportedSystem = errors.New("Unsupported system")
Functions ¶
func SetCircuitBreaker ¶
func SetCircuitBreaker(set ISetCircuitBreaker, cnf conf.IServerConf) (enable bool, err error)
SetCircuitBreaker 设置熔断配置
func SetHosts ¶
func SetHosts(set ISetHosts, cnf conf.IServerConf) (enable bool, err error)
SetHosts 设置hosts
func SetHttpRouters ¶
func SetHttpRouters(engine servers.IRegistryEngine, set ISetRouterHandler, cnf conf.IServerConf) (enable bool, err error)
SetHttpRouters 设置路由
func SetJWT ¶
func SetJWT(set ISetJwtAuth, cnf conf.IServerConf) (enable bool, err error)
SetJWT 设置jwt
func SetMetric ¶
func SetMetric(set ISetMetric, cnf conf.IServerConf) (enable bool, err error)
SetMetric 设置metric
func SetStatic ¶
func SetStatic(set ISetStatic, cnf conf.IServerConf) (enable bool, err error)
SetStatic 设置static
Types ¶
type IServer ¶
type IServer interface { Run() error Shutdown(timeout time.Duration) GetStatus() string GetAddress() string CloseCircuitBreaker() error SetCircuitBreaker(*conf.CircuitBreaker) error SetJWT(auth *conf.JWTAuth) error SetRouters(routers []*conf.Router) (err error) SetStatic(*conf.Static) error SetMetric(*conf.Metric) error StopMetric() error }
type ISetCircuitBreaker ¶
type ISetCircuitBreaker interface { CloseCircuitBreaker() error SetCircuitBreaker(*conf.CircuitBreaker) error }
ISetCircuitBreaker 设置CircuitBreaker
type ISetMetric ¶
type ISetRouterHandler ¶
ISetRouterHandler 设置路由列表
type ISetStatic ¶
type Option ¶
type Option func(*option)
Option 配置选项
func WithMetric ¶
WithMetric 设置基于influxdb的系统监控组件
type Routers ¶
type Routers struct {
// contains filtered or unexported fields
}
func GetRouters ¶
func GetRouters() *Routers
type WSServer ¶
type WSServer struct {
// contains filtered or unexported fields
}
WSServer WSServer服务器
func NewWSServerServer ¶
func NewWSServerServer(name string, addr string, routers []*conf.Router, opts ...Option) (t *WSServer, err error)
NewWSServerServer 创建WSServer服务器
func (*WSServer) CloseCircuitBreaker ¶
CloseCircuitBreaker 关闭熔断配置
func (*WSServer) SetCircuitBreaker ¶
func (s *WSServer) SetCircuitBreaker(c *conf.CircuitBreaker) error
SetCircuitBreaker 设置熔断配置
func (*WSServer) SetRouters ¶
SetRouters 设置路由配置
type WSServerResponsiveServer ¶
WSServerResponsiveServer WSServer 响应式服务器
func NewWSServerResponsiveServer ¶
func NewWSServerResponsiveServer(registryAddr string, cnf conf.IServerConf, logger *logger.Logger) (h *WSServerResponsiveServer, err error)
NewWSServerResponsiveServer 创建WSServer服务器
func (*WSServerResponsiveServer) GetAddress ¶
func (w *WSServerResponsiveServer) GetAddress() string
GetAddress 获取服务器地址
func (*WSServerResponsiveServer) GetServices ¶
func (w *WSServerResponsiveServer) GetServices() map[string][]string
GetServices 获取服务列表
func (*WSServerResponsiveServer) GetStatus ¶
func (w *WSServerResponsiveServer) GetStatus() string
GetStatus 获取当前服务器状态
func (*WSServerResponsiveServer) NeedRestart ¶
func (w *WSServerResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
NeedRestart 检查配置判断是否需要重启服务器
func (*WSServerResponsiveServer) Notify ¶
func (w *WSServerResponsiveServer) Notify(conf conf.IServerConf) error
Notify 服务器配置变更通知
func (*WSServerResponsiveServer) Restart ¶
func (w *WSServerResponsiveServer) Restart(cnf conf.IServerConf) (err error)
Restart 重启服务器
func (*WSServerResponsiveServer) Restarted ¶
func (w *WSServerResponsiveServer) Restarted() bool
Restarted 服务器是否已重启
func (*WSServerResponsiveServer) SetConf ¶
func (w *WSServerResponsiveServer) SetConf(restart bool, cnf conf.IServerConf) (err error)
SetConf 设置配置参数
func (*WSServerResponsiveServer) Shutdown ¶
func (w *WSServerResponsiveServer) Shutdown()
Shutdown 关闭服务器
func (*WSServerResponsiveServer) Start ¶
func (w *WSServerResponsiveServer) Start() (err error)
Start 启用服务
Click to show internal directories.
Click to hide internal directories.