bifrost

package
v1.0.0-alpha.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

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.5"

	// 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 AutoReload

func AutoReload(serverInfo *ServerInfo, config *nginx.Config, signal chan int)

AutoReload, web服务器配置文件自动热加载函数 参数:

serverInfo: web服务器配置文件信息对象指针
config: nginx配置对象指针
c: 整型管道,用于停止备份

func Bak

func Bak(serverInfo *ServerInfo, config *nginx.Config, signal chan int)

Bak, nginx配置文件备份函数 参数:

serverInfo: web服务器配置文件信息对象指针
config: nginx配置对象指针
c: 整型管道,用于停止备份

func Log

func Log(level logger.LogLevel, message string)

Log, 日志记录函数 参数:

level: 日志级别对象
message: 需记录的日志信息字符串

func PathExists

func PathExists(path string) (bool, error)

PathExists, 判断文件路径是否存在函数 返回值:

true: 存在; false: 不存在
错误

func Restart

func Restart() error

Restart, 守护进程 restart 方法函数 返回值:

错误

func Run

func Run()

Run, bifrost启动函数

func Start

func Start() (err error)

Start, 守护进程 start 方法函数 返回值:

错误

func Status

func Status() (int, error)

Status, 守护进程 status 方法函数 返回值:

错误

func Stop

func Stop() error

Stop, 守护进程 stop 方法函数 返回值:

错误

Types

type Config

type Config struct {
	WebServerInfo WebServerInfo `yaml:"WebServerInfo"`
	DBConfig      `yaml:"DBConfig"`
	LogConfig     `yaml:"logConfig"`
}

Config, bifrost配置文件结构体,定义bifrost配置信息

type DBConfig

type DBConfig 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"`
}

DBConfig, mysql数据库信息结构体,用于读写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 LogConfig

type LogConfig struct {
	LogDir string          `yaml:"logDir"`
	Level  logger.LogLevel `yaml:"level"`
}

LogConfig, bifrost日志信息结构体,定义日志目录、日志级别

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为其提供接口的路由及侦听端口

type WebServerInfo

type WebServerInfo struct {
	ListenPort int          `yaml:"listenPort"`
	Servers    []ServerInfo `yaml:"servers"`
}

WebServerInfo, bifrost配置文件对象中web服务器信息结构体,定义管控的web服务器配置文件相关信息

type WebServerType

type WebServerType string

WebServerType, web服务器类型对象,定义web服务器所属类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL