Documentation ¶
Index ¶
- Variables
- func CheckFixedSecret(cnf conf.IServerConf) (enable bool, err error)
- func CheckRemoteAuth(cnf conf.IServerConf) (enable bool, err error)
- func SetAjaxRequest(set IAjaxRequest, cnf conf.IServerConf) (enable bool, err error)
- func SetCircuitBreaker(set ISetCircuitBreaker, cnf conf.IServerConf) (enable bool, err error)
- func SetHeaders(set ISetHeaderHandler, 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 SetResponse(set ISetResponse, cnf conf.IServerConf) (enable bool, err error)
- func SetStatic(set ISetStatic, cnf conf.IServerConf) (enable bool, err error)
- func SetView(set ISetView, cnf conf.IServerConf) (enable bool, err error)
- type ApiResponsiveServer
- func (w *ApiResponsiveServer) GetAddress() string
- func (w *ApiResponsiveServer) GetServices() map[string][]string
- func (w *ApiResponsiveServer) GetStatus() string
- func (w *ApiResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
- func (w *ApiResponsiveServer) Notify(conf conf.IServerConf) error
- func (w *ApiResponsiveServer) Restart(cnf conf.IServerConf) (err error)
- func (w *ApiResponsiveServer) Restarted() bool
- func (w *ApiResponsiveServer) SetConf(restart bool, cnf conf.IServerConf) (err error)
- func (w *ApiResponsiveServer) Shutdown()
- func (w *ApiResponsiveServer) Start() (err error)
- type ApiServer
- func (s *ApiServer) CloseCircuitBreaker() error
- func (s *ApiServer) GetAddress(h ...string) string
- func (s *ApiServer) GetStatus() string
- func (s *ApiServer) Run() error
- func (s *ApiServer) SetAjaxRequest(allow bool) error
- func (s *ApiServer) SetCircuitBreaker(c *conf.CircuitBreaker) error
- func (s *ApiServer) SetHeader(headers conf.Headers) error
- func (s *ApiServer) SetHosts(hosts conf.Hosts) error
- func (s *ApiServer) SetJWT(auth *conf.JWTAuth) error
- func (s *ApiServer) SetMetric(metric *conf.Metric) error
- func (s *ApiServer) SetResponse(r *conf.Response) error
- func (s *ApiServer) SetRouters(routers []*conf.Router) (err error)
- func (s *ApiServer) SetStatic(static *conf.Static) error
- func (s *ApiServer) SetTrace(b bool)
- func (s *ApiServer) Shutdown(timeout time.Duration)
- func (s *ApiServer) StopMetric() error
- type Handler
- type IAjaxRequest
- type IServer
- type ISetCircuitBreaker
- type ISetHeaderHandler
- type ISetHosts
- type ISetJwtAuth
- type ISetMetric
- type ISetResponse
- type ISetRouterHandler
- type ISetStatic
- type ISetView
- 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 WithTLS(tls []string) Option
- func WithTimeout(readTimeout int, writeTimeout int, readHeaderTimeout int) Option
- type Routers
- type WebResponsiveServer
- func (w *WebResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
- func (w *WebResponsiveServer) Notify(conf conf.IServerConf) error
- func (w *WebResponsiveServer) Restart(cnf conf.IServerConf) (err error)
- func (w *WebResponsiveServer) SetConf(restart bool, conf conf.IServerConf) (err error)
- type WebServer
- func (s *WebServer) CloseCircuitBreaker() error
- func (s *WebServer) GetAddress(h ...string) string
- func (s *WebServer) GetStatus() string
- func (s *WebServer) Run() error
- func (s *WebServer) RunTLS(certFile, keyFile string) error
- func (s *WebServer) SetAjaxRequest(allow bool) error
- func (s *WebServer) SetCircuitBreaker(c *conf.CircuitBreaker) error
- func (s *WebServer) SetHeader(headers conf.Headers) error
- func (s *WebServer) SetHosts(hosts conf.Hosts) error
- func (s *WebServer) SetJWT(auth *conf.JWTAuth) error
- func (s *WebServer) SetMetric(metric *conf.Metric) error
- func (s *WebServer) SetResponse(r *conf.Response) error
- func (s *WebServer) SetRouters(routers []*conf.Router) (err error)
- func (s *WebServer) SetStatic(static *conf.Static) error
- func (s *WebServer) SetTrace(b bool)
- func (s *WebServer) SetView(view *conf.View) (err error)
- func (s *WebServer) Shutdown(timeout time.Duration)
- func (s *WebServer) StopMetric() error
Constants ¶
This section is empty.
Variables ¶
var ErrRootPrivileges = errors.New("You must have root user privileges. Possibly using 'sudo' command should help")
var ErrUnsupportedSystem = errors.New("Unsupported system")
Functions ¶
func CheckFixedSecret ¶
func CheckFixedSecret(cnf conf.IServerConf) (enable bool, err error)
CheckFixedSecret 设置FixedSecret
func CheckRemoteAuth ¶
func CheckRemoteAuth(cnf conf.IServerConf) (enable bool, err error)
CheckRemoteAuth 检查是否设置remote-auth
func SetAjaxRequest ¶
func SetAjaxRequest(set IAjaxRequest, cnf conf.IServerConf) (enable bool, err error)
SetAjaxRequest 设置ajax
func SetCircuitBreaker ¶
func SetCircuitBreaker(set ISetCircuitBreaker, cnf conf.IServerConf) (enable bool, err error)
SetCircuitBreaker 设置熔断配置
func SetHeaders ¶
func SetHeaders(set ISetHeaderHandler, cnf conf.IServerConf) (enable bool, err error)
SetHeaders 设置header
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 SetResponse ¶
func SetResponse(set ISetResponse, cnf conf.IServerConf) (enable bool, err error)
SetResponse 设置response配置串
func SetStatic ¶
func SetStatic(set ISetStatic, cnf conf.IServerConf) (enable bool, err error)
SetStatic 设置static
Types ¶
type ApiResponsiveServer ¶
ApiResponsiveServer api 响应式服务器
func NewApiResponsiveServer ¶
func NewApiResponsiveServer(registryAddr string, cnf conf.IServerConf, logger *logger.Logger) (h *ApiResponsiveServer, err error)
NewApiResponsiveServer 创建API服务器
func (*ApiResponsiveServer) GetAddress ¶
func (w *ApiResponsiveServer) GetAddress() string
GetAddress 获取服务器地址
func (*ApiResponsiveServer) GetServices ¶
func (w *ApiResponsiveServer) GetServices() map[string][]string
GetServices 获取服务列表
func (*ApiResponsiveServer) GetStatus ¶
func (w *ApiResponsiveServer) GetStatus() string
GetStatus 获取当前服务器状态
func (*ApiResponsiveServer) NeedRestart ¶
func (w *ApiResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
NeedRestart 检查配置判断是否需要重启服务器
func (*ApiResponsiveServer) Notify ¶
func (w *ApiResponsiveServer) Notify(conf conf.IServerConf) error
Notify 服务器配置变更通知
func (*ApiResponsiveServer) Restart ¶
func (w *ApiResponsiveServer) Restart(cnf conf.IServerConf) (err error)
Restart 重启服务器
func (*ApiResponsiveServer) Restarted ¶
func (w *ApiResponsiveServer) Restarted() bool
Restarted 服务器是否已重启
func (*ApiResponsiveServer) SetConf ¶
func (w *ApiResponsiveServer) SetConf(restart bool, cnf conf.IServerConf) (err error)
SetConf 设置配置参数
type ApiServer ¶
type ApiServer struct {
// contains filtered or unexported fields
}
ApiServer api服务器
func NewApiServer ¶
func NewApiServer(name string, addr string, routers []*conf.Router, opts ...Option) (t *ApiServer, err error)
NewApiServer 创建api服务器
func (*ApiServer) CloseCircuitBreaker ¶
CloseCircuitBreaker 关闭熔断配置
func (*ApiServer) GetAddress ¶
GetAddress 获取当前服务地址
func (*ApiServer) SetAjaxRequest ¶
SetAjaxRequest 只允许ajax请求
func (*ApiServer) SetCircuitBreaker ¶
func (s *ApiServer) SetCircuitBreaker(c *conf.CircuitBreaker) error
SetCircuitBreaker 设置熔断配置
func (*ApiServer) SetResponse ¶
SetResponse 设置response配置
func (*ApiServer) SetRouters ¶
SetRouters 设置路由配置
type IServer ¶
type IServer interface { Run() error Shutdown(timeout time.Duration) GetStatus() string GetAddress(h ...string) string CloseCircuitBreaker() error SetCircuitBreaker(*conf.CircuitBreaker) error SetResponse(*conf.Response) error SetRouters(routers []*conf.Router) (err error) SetJWT(auth *conf.JWTAuth) error SetAjaxRequest(allow bool) error SetHosts(conf.Hosts) error SetStatic(*conf.Static) error SetMetric(*conf.Metric) error SetHeader(conf.Headers) error StopMetric() error }
type ISetCircuitBreaker ¶
type ISetCircuitBreaker interface { CloseCircuitBreaker() error SetCircuitBreaker(*conf.CircuitBreaker) error }
ISetCircuitBreaker 设置CircuitBreaker
type ISetHeaderHandler ¶
ISetHeaderHandler 设置header
type ISetMetric ¶
type ISetResponse ¶
ISetResponse 设置response配置串
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 WebResponsiveServer ¶
type WebResponsiveServer struct { *ApiResponsiveServer // contains filtered or unexported fields }
WebResponsiveServer web 响应式服务器
func NewWebResponsiveServer ¶
func NewWebResponsiveServer(registryAddr string, cnf conf.IServerConf, logger *logger.Logger) (h *WebResponsiveServer, err error)
NewWebResponsiveServer 构建基于注册中心的响应式web服务器
func (*WebResponsiveServer) NeedRestart ¶
func (w *WebResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
NeedRestart 检查配置判断是否需要重启服务器
func (*WebResponsiveServer) Notify ¶
func (w *WebResponsiveServer) Notify(conf conf.IServerConf) error
Notify 服务器配置变更通知
func (*WebResponsiveServer) Restart ¶
func (w *WebResponsiveServer) Restart(cnf conf.IServerConf) (err error)
Restart 重启服务器
func (*WebResponsiveServer) SetConf ¶
func (w *WebResponsiveServer) SetConf(restart bool, conf conf.IServerConf) (err error)
SetConf 设置配置参数
type WebServer ¶
type WebServer struct {
// contains filtered or unexported fields
}
WebServer web服务器
func NewWebServer ¶
func NewWebServer(name string, addr string, routers []*conf.Router, opts ...Option) (t *WebServer, err error)
NewWebServer 创建web服务器
func (*WebServer) CloseCircuitBreaker ¶
CloseCircuitBreaker 关闭熔断配置
func (*WebServer) GetAddress ¶
GetAddress 获取当前服务地址
func (*WebServer) SetAjaxRequest ¶
SetAjaxRequest 只允许ajax请求
func (*WebServer) SetCircuitBreaker ¶
func (s *WebServer) SetCircuitBreaker(c *conf.CircuitBreaker) error
SetCircuitBreaker 设置熔断配置
func (*WebServer) SetResponse ¶
SetResponse 设置response配置
func (*WebServer) SetRouters ¶
SetRouters 设置路由配置