Documentation ¶
Index ¶
- func AuthMiddleware(c *fiber.Ctx) error
- func AuthMiddleware2(db *gorm.DB, JWTSecret string) fiber.Handler
- func AwakeModules(app *App)
- func DestroySession(c *fiber.Ctx) error
- func GetSession(c *fiber.Ctx) (bool, uint)
- func HasPermission(permissionCode string, userFunc func(c *fiber.Ctx) *models.User) fiber.Handler
- func InitAuthRouters()
- func InitPublicRouters()
- func IsDevelopment() bool
- func IsSecureMode() bool
- func LoadConfig() error
- func RegisterModule(module Module, priority int)
- func SessionSetup(dbDriver string, db *sql.DB, dsn, tableName string)
- func SetSessionExpiration(c *fiber.Ctx, duration time.Duration) error
- func SkipAuthRoute(path string)
- func StoreSession(c *fiber.Ctx, userID uint) error
- func UpdateDatabaseConfig(newConfig DatabaseConfig)
- func UpdateFTPConfig(newConfig FTPConfig)
- func UpdateServerConfig(newConfig ServerConfig)
- type App
- type AppConfig
- type AuthConfig
- type BaseModule
- type Config
- type DatabaseConfig
- type FTPConfig
- type FiberSession
- type JSONPathConfig
- type Module
- type SQLiteStorage
- type ServerConfig
- type StaticPathConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(c *fiber.Ctx) error
func AuthMiddleware2 ¶
AuthMiddleware 认证中间件
func HasPermission ¶
HasPermission 权限检查中间件
func LoadConfig ¶
func LoadConfig() error
func SessionSetup ¶
SessionSetup 初始化session存储
func SetSessionExpiration ¶
SetSessionExpiration 设置session过期时间
func UpdateDatabaseConfig ¶
func UpdateDatabaseConfig(newConfig DatabaseConfig)
func UpdateFTPConfig ¶
func UpdateFTPConfig(newConfig FTPConfig)
func UpdateServerConfig ¶
func UpdateServerConfig(newConfig ServerConfig)
Types ¶
type App ¶
type App struct { FiberApp *fiber.App DB *gorm.DB DBs []*gorm.DB Config *Config RouterPublic fiber.Router RouterPublicApi fiber.Router RouterApi fiber.Router RouterAdmin fiber.Router }
func (*App) HasPermission ¶
func (*App) IsInitializedModule ¶
如果模块已初始化,则跳过
type AuthConfig ¶
type BaseModule ¶
type BaseModule struct {
App *App
}
func (*BaseModule) AddAuthRouters ¶
func (m *BaseModule) AddAuthRouters() error
func (*BaseModule) AddPublicRouters ¶
func (m *BaseModule) AddPublicRouters() error
func (*BaseModule) Awake ¶
func (m *BaseModule) Awake(a *App) error
func (*BaseModule) Start ¶
func (m *BaseModule) Start() error
type Config ¶
type Config struct { App AppConfig `toml:"app"` Server ServerConfig `toml:"server"` Database DatabaseConfig `toml:"database"` JSONPaths JSONPathConfig `toml:"json_paths"` FTP FTPConfig `toml:"ftp"` Auth AuthConfig `toml:"auth"` }
type DatabaseConfig ¶
type DatabaseConfig struct { Driver string `toml:"driver"` DSN string `toml:"dsn"` MaxOpenConns int `toml:"max_open_conns"` MaxIdleConns int `toml:"max_idle_conns"` ConnMaxLifetime int64 `toml:"conn_max_lifetime"` }
func GetDatabaseConfig ¶
func GetDatabaseConfig() DatabaseConfig
type FTPConfig ¶
type FTPConfig struct { Host string `toml:"host"` Port string `toml:"port"` User string `toml:"user"` Password string `toml:"password"` APKPath string `toml:"apk_path"` ZIPPath string `toml:"zip_path"` LogDir string `toml:"log_dir"` MaxLogSize int64 `toml:"max_log_size"` }
func GetFTPConfig ¶
func GetFTPConfig() FTPConfig
type FiberSession ¶
type FiberSession struct { K string `gorm:"column:k;primaryKey"` // key V string `gorm:"column:v;not null"` // value E int64 `gorm:"column:e;default:0"` // expiry }
FiberSession Fiber默认的会话表结构
type JSONPathConfig ¶
type JSONPathConfig struct { ServerList string `toml:"server_list"` LastServer string `toml:"last_server"` ServerInfo string `toml:"server_info"` NoticeList string `toml:"notice_list"` NoticeNum string `toml:"notice_num"` }
func GetJSONPathConfig ¶
func GetJSONPathConfig() JSONPathConfig
type SQLiteStorage ¶
type SQLiteStorage struct {
// contains filtered or unexported fields
}
SQLiteStorage 实现 fiber.Storage 接口
func NewSQLiteStorage ¶
func NewSQLiteStorage(dsn string) (*SQLiteStorage, error)
NewSQLiteStorage 创建新的SQLite存储
type ServerConfig ¶
type ServerConfig struct { Host string `toml:"host"` Port int `toml:"port"` Output string `toml:"output"` ScriptPath string `toml:"script_path"` StaticPaths []StaticPathConfig `toml:"static_paths"` UserDataPath string `toml:"user_data_path"` CDNPath string `toml:"cdn_path"` CDN2Path string `toml:"cdn2_path"` }
func GetServerConfig ¶
func GetServerConfig() ServerConfig
type StaticPathConfig ¶
Click to show internal directories.
Click to hide internal directories.