Documentation
¶
Index ¶
- Constants
- Variables
- func ListenSignal(sigChan chan<- int)
- func Log(level logger.LogLevel, message string, a ...interface{})
- func PathExists(path string) (bool, error)
- func Restart() error
- func Run()
- func Start() (err error)
- func Status() (int, error)
- func Stop() error
- type AuthConfig
- type AuthDBConfig
- type Config
- type JWTClaims
- type LogConfig
- type ServerInfo
- type WebServerInfo
- type WebServerType
Constants ¶
View Source
const ( // 认证接口错误返回 ErrorReasonServerBusy = "服务器繁忙" ErrorReasonRelogin = "请重新登陆" ErrorReasonWrongPassword = "用户或密码错误" )
View Source
const ( // 日志级别 CRITICAL = logger.CriticalLevel ERROR = logger.ErrorLevel WARN = logger.WarningLevel NOTICE = logger.NoticeLevel INFO = logger.InfoLevel DEBUG = logger.DebugLevel // 版本号 VERSION = "v1.0.0-alpha.7" // Web服务类型 NGINX WebServerType = "nginx" HTTPD WebServerType = "httpd" )
Variables ¶
View Source
var ( Signal = flag.String("s", "", "send `signal` to a master process: stop, restart, status") // bifrost配置 BifrostConf *Config // 日志文件 Logf *os.File Stdoutf *os.File )
View Source
var (
ExpireTime = 3600 // token有效期
)
Functions ¶
func ListenSignal ¶
func ListenSignal(sigChan chan<- int)
Types ¶
type AuthConfig ¶
AuthConfig, 认证信息结构体,记录用户认证信息(可选)
type AuthDBConfig ¶
type AuthDBConfig struct {
DBName string `yaml:"DBName"`
Host string `yaml:"host"`
Port int `yaml:"port"`
Protocol string `yaml:"protocol"`
User string `yaml:"user"`
Password string `yaml:"password"`
}
AuthDBConfig, mysql数据库信息结构体,该库用于存放用户认证信息(可选)
type Config ¶
type Config struct {
WebServerInfo WebServerInfo `yaml:"WebServerInfo"`
*AuthDBConfig `yaml:"AuthDBConfig,omitempty"`
*AuthConfig `yaml:"AuthConfig,omitempty"`
LogConfig `yaml:"LogConfig"`
}
Config, bifrost配置文件结构体,定义bifrost配置信息
type JWTClaims ¶
type JWTClaims struct {
jwt.StandardClaims
UserID int `json:"user_id"`
Password string `json:"password"`
Username string `json:"username"`
FullName string `json:"full_name"`
Permissions []string `json:"permissions"`
}
JWTClaims, jwt断言对象,定义认证接口校验的用户信息
type ServerInfo ¶
type ServerInfo struct {
Name string `yaml:"name"`
ServerType WebServerType `yaml:"serverType"`
BaseURI string `yaml:"baseURI"`
BackupCycle int `yaml:"backupCycle"`
BackupSaveTime int `yaml:"backupSaveTime"`
BackupDir string `yaml:"backupDir,omitempty"`
ConfPath string `yaml:"confPath"`
VerifyExecPath string `yaml:"verifyExecPath"`
// contains filtered or unexported fields
}
ServerInfo, nginx配置文件信息结构体,定义配置文件路径、nginx可执行文件路径和bifrost为其提供接口的路由及侦听端口
func (*ServerInfo) AutoReload ¶
func (si *ServerInfo) AutoReload(signal chan int)
AutoReload, ServerInfo的web服务器配置文件自动热加载方法 参数:
c: 整型管道,用于停止备份
func (ServerInfo) Bak ¶
func (si ServerInfo) Bak(signal chan int)
Bak, ServerInfo的nginx配置文件备份方法 参数:
c: 整型管道,用于停止备份
type WebServerInfo ¶
type WebServerInfo struct {
ListenPort int `yaml:"listenPort"`
Servers []ServerInfo `yaml:"servers,flow"`
}
WebServerInfo, bifrost配置文件对象中web服务器信息结构体,定义管控的web服务器配置文件相关信息
Click to show internal directories.
Click to hide internal directories.