handlers

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Matches *MatchesEngine
	Auth    string
	Delay   uint32
)

Functions

func GetBodyByIDHandler

func GetBodyByIDHandler(c *gin.Context)

GetBodyByIDHandler handles fragment request from CS:GO client

func GetBodyHandler

func GetBodyHandler(c *gin.Context)

GetBodyHandler handles fragment request from CS:GO client

func GetListHandler

func GetListHandler(c *gin.Context)

GetListHandler handles list of Matches

func InitMatchEngine

func InitMatchEngine(auth string, delay uint32)

InitMatchEngine Initializes MatchEngine

func PostBodyByIDHandler

func PostBodyByIDHandler(c *gin.Context)

func PostBodyHandler

func PostBodyHandler(c *gin.Context)

PostBodyHandler handles fragment registration from CS:GO Server

func SyncByIDHandler

func SyncByIDHandler(c *gin.Context)

SyncByIDHandler handlers request against /match/:token/sync by ID

func SyncHandler

func SyncHandler(c *gin.Context)

SyncHandler handlers request against /match/:token/sync

Types

type Deltaframes

type Deltaframes struct {
	At      time.Time
	Body    []byte
	EndTick uint64
}

type Fullframe

type Fullframe struct {
	At   time.Time
	Tick uint64
	Body []byte
}

type Match

type Match struct {
	sync.Mutex
	ID    string // Manually tagged ID.
	Token string // Match token
	Auth  string // auth for POST auths

	Startframe  map[uint32]*Startframe  // start frame data
	Fullframes  map[uint32]*Fullframe   // full frame data
	Deltaframes map[uint32]*Deltaframes // delta frame data

	SignupFragment uint32 // sign up fragment for /sync
	Tps            uint32 // tickrate per secs for /sync
	Map            string // map for /sync
	Protocol       uint8  // protocol for /sync

	// RtDelay uint8  // Real-time delay: delay of this fragment from real-time, in seconds
	// RcVage  uint8  // Receive age: how many seconds since relay last received data from game server
	Latest uint32 // latest fragment number
}

func (*Match) GetDeltaFrame added in v1.1.0

func (m *Match) GetDeltaFrame(fragnumber uint32) (*Deltaframes, error)

func (*Match) GetFullFrame

func (m *Match) GetFullFrame(fragnumber uint32) (*Fullframe, error)

func (*Match) GetStartFrame added in v1.1.0

func (m *Match) GetStartFrame(fragnumber uint32) (*Startframe, error)

func (*Match) IsSyncReady added in v1.1.0

func (m *Match) IsSyncReady(fragnumber uint32) bool

func (*Match) RegisterDeltaFrame added in v1.1.0

func (m *Match) RegisterDeltaFrame(fragment uint32, delta *Deltaframes) error

func (*Match) RegisterFullFrame added in v1.1.0

func (m *Match) RegisterFullFrame(fragment uint32, full *Fullframe) error

func (*Match) RegisterStartFrame added in v1.1.0

func (m *Match) RegisterStartFrame(fragment uint32, start *Startframe, tps uint32) error

func (*Match) SaveMatchToFile added in v1.1.0

func (m *Match) SaveMatchToFile(filename string) error

func (*Match) Sync added in v1.1.0

func (m *Match) Sync(fragnumber uint32) (*SyncJSON, error)

func (*Match) TagID

func (m *Match) TagID(id string) error

type MatchesEngine

type MatchesEngine struct {
	sync.Mutex
	Matches map[string]*Match // string=token
	Auth    string
	Delay   uint32
}

func (*MatchesEngine) Delete added in v1.1.0

func (m *MatchesEngine) Delete(ms *Match) error

func (*MatchesEngine) GetAll

func (m *MatchesEngine) GetAll() ([]*Match, error)

func (*MatchesEngine) GetMatchByID

func (m *MatchesEngine) GetMatchByID(id string) (*Match, error)

func (*MatchesEngine) GetMatchByToken

func (m *MatchesEngine) GetMatchByToken(token string) (*Match, error)

func (*MatchesEngine) GetTokens

func (m *MatchesEngine) GetTokens() ([]string, error)

func (*MatchesEngine) LoadMatchFromFile added in v1.1.0

func (m *MatchesEngine) LoadMatchFromFile(path string) (string, error)

func (*MatchesEngine) Register

func (m *MatchesEngine) Register(ms *Match)

type Startframe

type Startframe struct {
	At   time.Time
	Body []byte
}

type SyncJSON added in v1.1.0

type SyncJSON struct {
	Tick             uint64  `json:"tick"`
	Endtick          uint64  `json:"endtick,omitempty"`
	RealTimeDelay    float64 `json:"rtdelay,omitempty"`
	ReceiveAge       float64 `json:"rcvage,omitempty"`
	Fragment         uint32  `json:"fragment"`
	SignupFragment   uint32  `json:"signup_fragment"`
	TickPerSecond    uint32  `json:"tps"`
	KeyframeInterval float64 `json:"keyframe_interval,omitempty"`
	Map              string  `json:"map"`
	Protocol         uint8   `json:"protocol"`
}

Jump to

Keyboard shortcuts

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