ctftime

package
v0.0.0-...-77c539c Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CTFtime

type CTFtime struct {
	BaseURL string
}

CTFtime struct with BaseURL

func New

func New() *CTFtime

New creates a new CTFtime struct with a pre-defined BaseURL

func (*CTFtime) Get

func (ctf *CTFtime) Get(endpoint string) (*http.Response, error)

Get is used to perform a GET request on a CTFtime endpoint

func (*CTFtime) GetEvents

func (ctf *CTFtime) GetEvents(limit int, startTime time.Time, finishTime time.Time) (Events, error)

GetEvents returns events between startTime and endTime. The number of events is defined by the value of limit.

type Duration

type Duration struct {
	Hours int `json:"hours"`
	Days  int `json:"days"`
}

Duration consists of the number of hours and number of days for a CTFtime event

type Event

type Event struct {
	Organizers    []Organizer  `json:"organizers"`
	OnSite        bool         `json:"onsite" db:"OnSite"`
	Finish        time.Time    `json:"finish" db:"Finish"`
	Description   string       `json:"description" db:"Description"`
	Weight        float64      `json:"weight" db:"Weight"`
	Title         string       `json:"title" db:"Title"`
	URL           string       `json:"url" db:"URL"`
	IsVotableNow  bool         `json:"is_votable_now" db:"IsVotableNow"`
	Restrictions  string       `json:"restrictions" db:"Restrictions"`
	Format        string       `json:"format" db:"Format"`
	Start         time.Time    `json:"start" db:"Start"`
	Participants  int          `json:"participants" db:"Participants"`
	CtftimeURL    string       `json:"ctftime_url" db:"CtftimeURL"`
	Location      string       `json:"location" db:"Location"`
	LiveFeed      string       `json:"live_feed" db:"LiveFeed" db:"LiveFeed"`
	PublicVotable bool         `json:"public_votable" db:"PublicVotable"`
	Duration      Duration     `json:"duration"`
	FormatID      int          `json:"format_id" db:"FormatID"`
	ID            int          `json:"id" db:"ID"`
	CtfID         int          `json:"ctf_id" db:"CtfID"`
	Status        utils.Status `db:"Status"`
	Organizer     string       `db:"Organizer"`
}

Event defines a single event obtained from CTFtime

type Events

type Events []Event

Events is a slice of type Event

type Organizer

type Organizer struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Organizer defines the structure of an organizer as obtained from CTFtime

type Team

type Team struct {
	Name    string   `json:"name"`
	Country string   `json:"country"`
	ID      int      `json:"id"`
	Aliases []string `json:"aliases"`
}

Team defines the structure of a single team on CTFtime

Jump to

Keyboard shortcuts

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