server

package
v0.6.20 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ip string, port int, cert string, key string, debug bool, t *Tracker, m *autocert.Manager, tor bool, limit *limiter.Limiter) (err error)

Start brings up the TCP server.

func StartStatsServer added in v0.1.1

func StartStatsServer(ip string, port int, cert string, key string, si StatsInformer, m *autocert.Manager, tor bool, limit *limiter.Limiter) error

StartStatsServer creates a new server to serve stats

func StartWebsocket added in v0.4.0

func StartWebsocket(ip string, port int, cert string, key string, debug bool, t *Tracker, m *autocert.Manager, tor bool, limit *limiter.Limiter) (err error)

StartWebsocket brings up the websocket server.

Types

type PlayerData added in v0.6.16

type PlayerData struct {
	// contains filtered or unexported fields
}

PlayerData is data needed about each connection.

func (*PlayerData) String added in v0.6.19

func (p *PlayerData) String() string

type Pool added in v0.6.13

type Pool struct {
	// contains filtered or unexported fields
}

Pool groups players together for a shuffle

func (*Pool) AddPlayer added in v0.6.13

func (pool *Pool) AddPlayer(player *PlayerData) bool

AddPlayer attempts to place player in the pool and returns success boolean

func (*Pool) IsBanned added in v0.6.13

func (pool *Pool) IsBanned(player *PlayerData) bool

IsBanned returns true if the player has been banned by their pool. This assumes that only one ban will happen per pool.

func (*Pool) IsFrozen added in v0.6.13

func (pool *Pool) IsFrozen() bool

IsFrozen returns true if the pool is frozen and will not add new players.

func (*Pool) PlayerCount added in v0.6.13

func (pool *Pool) PlayerCount() int

PlayerCount returns the number of players in a pool.

func (*Pool) PlayerFromSnapshot added in v0.6.13

func (pool *Pool) PlayerFromSnapshot(verificationKey string) *PlayerData

PlayerFromSnapshot returns the user for the key or nil if they are not in the snapshot.

func (*Pool) RemovePlayer added in v0.6.13

func (pool *Pool) RemovePlayer(player *PlayerData)

RemovePlayer removes a player from the pool This method depends on the caller discard the pool if empty.

type PoolStats added in v0.1.1

type PoolStats struct {
	Members int    `json:"members"`
	Amount  uint64 `json:"amount"`
	Type    string `json:"type"`
	Full    bool   `json:"full"`
	Version uint64 `json:"version"`
}

PoolStats represents the stats for a particular pool

type StatsInformer added in v0.1.1

type StatsInformer interface {
	Stats(string, bool) *TrackerStats
}

StatsInformer defines an interface that exposes tracker stats

type Tracker added in v0.2.0

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker is used to track connections to the server.

func NewTracker added in v0.1.1

func NewTracker(poolSize int, shufflePort int, shuffleWebSocketPort int, torShufflePort int, torShuffleWebSocketPort int) *Tracker

NewTracker instantiates a new tracker

func (*Tracker) CleanupDeniedByIPMatch added in v0.6.4

func (t *Tracker) CleanupDeniedByIPMatch()

CleanupDeniedByIPMatch removes timed out denyIPMatch entries.

func (*Tracker) Stats added in v0.2.0

func (t *Tracker) Stats(ip string, tor bool) *TrackerStats

Stats returns the tracker stats.

type TrackerStats added in v0.1.1

type TrackerStats struct {
	BanScore             uint32      `json:"banScore"`
	Banned               bool        `json:"banned"`
	Connections          int         `json:"connections"`
	PoolSize             int         `json:"poolSize"`
	Pools                []PoolStats `json:"pools"`
	ShufflePort          int         `json:"shufflePort"`
	ShuffleWebSocketPort int         `json:"shuffleWebSocketPort"`
}

TrackerStats represents a snapshot of the trackers statistics

Jump to

Keyboard shortcuts

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