Documentation
¶
Index ¶
- Constants
- Variables
- func CloseDB()
- func CombinedMiddleware(config config.Config, db *bbolt.DB) gin.HandlerFunc
- func GenerateCookie() (string, error)
- func HandleCheckLoginStatusRequest(c *gin.Context)
- func HandleGetBan(c *gin.Context, config config.Config, db *bbolt.DB)
- func HandleGetJSON(c *gin.Context, cfg config.Config)
- func HandleGetPalguardJson(c *gin.Context)
- func HandleLoginRequest(c *gin.Context, config config.Config)
- func HandleRestart(c *gin.Context, cfg config.Config)
- func HandleRestartSelf(c *gin.Context, cfg config.Config)
- func HandleSaveJSON(c *gin.Context, cfg config.Config)
- func HandleSavePalguardJson(c *gin.Context)
- func HandleSetUnban(c *gin.Context, config config.Config)
- func HandleStart(c *gin.Context, cfg config.Config)
- func HandleStop(c *gin.Context, cfg config.Config)
- func InitDB() *bbolt.DB
- func InitializeDB()
- func IsPlayerInWhitelist(player *config.PlayerW, whitelist []*config.PlayerW) bool
- func ValidateCookie(cookie string) (bool, error)
- func WsHandlerWithDependencies(c *gin.Context, cfg config.Config)
- type AddWhiteRequest
- type BroadcastRequest
- type ChangeSaveRequest
- type Client
- type KickOrBanRequest
- type Player
- type RconClient
- type RestartLaterRequest
- type SaveNowRequest
Constants ¶
View Source
const ( DBName = "cookie.db" CookieBucket = "cookies" ExpirationKey = "expiration" ExpirationHours = 30 * 24 // Cookie 有效期改为一个月 )
Variables ¶
View Source
var ErrCookieExpired = errors.New("cookie has expired")
View Source
var ErrCookieNotFound = errors.New("cookie not found")
Functions ¶
func CombinedMiddleware ¶
NewCombinedMiddleware 创建并返回一个带有依赖的中间件闭包
func GenerateCookie ¶
func HandleCheckLoginStatusRequest ¶
HandleCheckLoginStatusRequest 检查登录状态的处理函数
func HandleGetBan ¶
HandleGetBan 处理/api/getban的GET请求
func HandleGetJSON ¶
HandleGetJSON 返回当前的config作为JSON
func HandleGetPalguardJson ¶
HandleGetPalguardJson 返回palguard.json的内容
func HandleLoginRequest ¶
HandleLoginRequest处理登录请求
func HandleSaveJSON ¶
HandleSaveJSON 从请求体中读取JSON并更新config
func HandleSavePalguardJson ¶
HandleSavePalguardJson 从请求体中读取JSON并写入palguard.json
func HandleSetUnban ¶
HandleSetUnban 处理/api/setunban的POST请求
func InitializeDB ¶
func InitializeDB()
func IsPlayerInWhitelist ¶
func ValidateCookie ¶
Types ¶
type AddWhiteRequest ¶
type BroadcastRequest ¶
type BroadcastRequest struct {
Message string `json:"message"`
}
BroadcastRequest 用于解析传入的JSON请求体
type ChangeSaveRequest ¶
type ChangeSaveRequest struct {
Path string `json:"path"`
}
ChangeSaveRequest 用于解析请求体
type KickOrBanRequest ¶
type RconClient ¶
RconClient 结构体,用于存储RCON连接和配置信息
func NewRconClient ¶
func NewRconClient(address, password string) *RconClient
NewRconClient 创建一个新的RCON客户端
type RestartLaterRequest ¶
RestartLaterRequest 用于绑定JSON请求体
type SaveNowRequest ¶
type SaveNowRequest struct {
Timestamp int64 `json:"timestamp"`
}
SaveNowRequest 用于解析请求体
Click to show internal directories.
Click to hide internal directories.