dbold

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "20201127"

If the version is different from the database record, it will ask user for cleaning the database.

Variables

View Source
var MySQL *gorm.DB

Functions

func InitMySQL

func InitMySQL()

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 Bulletin

type Bulletin struct {
	gorm.Model

	Title   string
	Content string
}

Bulletin is a gorm model for database table `bulletins`.

type BulletinRead

type BulletinRead struct {
	gorm.Model

	TeamID     uint
	BulletinID uint
}

BulletinRead gorm model, used to store the bulletin is read by a team.

type Challenge

type Challenge struct {
	gorm.Model
	Title           string
	BaseScore       int
	AutoRefreshFlag bool
	Command         string
}

Challenge is a gorm model for database table `challenges`, used to store the challenges like Web1, Pwn1.

type DownAction

type DownAction struct {
	gorm.Model

	TeamID      uint
	ChallengeID uint
	GameBoxID   uint
	Round       int
}

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

type Flag struct {
	gorm.Model

	TeamID      uint
	GameBoxID   uint
	ChallengeID uint
	Round       int
	Flag        string
}

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:"-"`
	Score     float64
	SecretKey string
}

Team is a gorm model for database table `teams`.

type Token

type Token struct {
	gorm.Model

	TeamID uint
	Token  string
}

Token is a gorm model for database table `tokens`. It used to store team token.

type WebHook

type WebHook struct {
	gorm.Model

	URL   string
	Type  string
	Token string

	Retry   int
	Timeout int
}

WebHook is a gorm model for database table `webhook`, used to store the webhook.

Jump to

Keyboard shortcuts

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