Documentation
¶
Index ¶
Constants ¶
const VERSION = "20201127"
If the version is different from the database record, it will ask user for cleaning the database.
Variables ¶
var MySQL *gorm.DB
Functions ¶
Types ¶
type AttackAction ¶
type AttackAction struct {
gorm.Model
TeamID uint // Victim's team ID
GameBoxID uint // Victim's gamebox ID
ChallengeID uint // Victim's challenge ID
AttackerTeamID uint // Attacker's Team ID
Round int
}
AttackAction is a gorm model for database table `attack_actions`. Used to store the flag submitted record.
type BulletinRead ¶
BulletinRead gorm model, used to store the bulletin is read by a team.
type Challenge ¶
Challenge is a gorm model for database table `challenges`, used to store the challenges like Web1, Pwn1.
type DownAction ¶
DownAction is a gorm model for database table `down_actions`.
type DynamicConfig ¶
type DynamicConfig struct {
gorm.Model `json:"-"`
Key string
Value string
Kind int8
Options string
}
DynamicConfig is the config which is stored in database. So it's a GORM model for users can edit it anytime.
type Flag ¶
Flag is a gorm model for database table `flags`. All the flags will be generated before the competition start and save in this table.
type GameBox ¶
type GameBox struct {
gorm.Model
ChallengeID uint
TeamID uint
IP string
Port string
SSHPort string
SSHUser string
SSHPassword string
Description string
Visible bool
Score float64 // The score can be negative.
IsDown bool
IsAttacked bool
}
GameBox is a gorm model for database table `gameboxes`.
type Log ¶
type Log struct {
gorm.Model
Level int // 0 - Normal, 1 - Warning, 2 - Important
Kind string
Content string
}
Log is a gorm model for database table `logs`.
type Manager ¶
type Manager struct {
gorm.Model
Name string
Password string `json:"-"`
IsCheck bool
Token string // For single sign-on
}
Manager is a gorm model for database table `managers`.
type Score ¶
type Score struct {
gorm.Model
TeamID uint
GameBoxID uint
Round int
Reason string
Score float64 `gorm:"index"`
}
Score is a gorm model for database table `scores`. Every action (checkdown, attacked...) will be created a score record, and the total score will be calculated by SUM(`score`).
type Team ¶
type Team struct {
gorm.Model
Name string
Password string `json:"-"`
Logo string
Score float64
SecretKey string
}
Team is a gorm model for database table `teams`.