extra

package
v4.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIDType = errors.New("invalid sid type")
	ErrWrite  = errors.New("failed to write to output file")
	ErrFlush  = errors.New("failed to flush contents")
)
View Source
var (
	ErrParsePlayers    = errors.New("failed to parse players")
	ErrParseEdict      = errors.New("failed to parse edicts")
	ErrParseEdictTotal = errors.New("failed to parse total edicts")
	ErrParseUserID     = errors.New("failed to parse user id")
	ErrParsePing       = errors.New("failed to parse ping")
	ErrParseLoss       = errors.New("failed to parse loss")
	ErrParseSeconds    = errors.New("failed to parse seconds")
	ErrParseDuration   = errors.New("failed to parse duration")
	ErrParseIP         = errors.New("failed to parse ip")
	ErrParsePort       = errors.New("failed to parse port")
)

Functions

func FindReaderSteamIDs added in v4.0.2

func FindReaderSteamIDs(reader io.Reader) []steamid.SteamID

FindReaderSteamIDs attempts to parse any strings of any known format within the body to a common SID64 format.

func ParseReader

func ParseReader(input io.Reader, output io.Writer, format string, idType string) error

ParseReader attempt to find all types of steam ids in the data stream provided by the input reader. It will write the output of what it finds to the output writer applying the formatting strings to each value. The formatting string takes the same formatting as the standard fmt.SprintF() and expects one %s token.

A formatting example to place each steam id on a newline: "%s\n"

idType specifies what output id format to use when writing: steam, steam3, steam32, steam64 are the valid choices.

func SIDSFromStatus

func SIDSFromStatus(text string) []steamid.SteamID

SIDSFromStatus will parse the output of the console command `status` and return a set of SID64s representing all the players.

Types

type Player

type Player struct {
	UserID        int
	Name          string
	SID           steamid.SteamID
	ConnectedTime time.Duration
	Ping          int
	Loss          int
	State         string
	IP            net.IP
	Port          int
}

Player represents all the available data for a player in a `status` output table.

type Status

type Status struct {
	PlayersCount int
	PlayersMax   int
	ServerName   string
	Version      string
	Edicts       []int
	Tags         []string
	Map          string
	Players      []Player
}

func ParseStatus

func ParseStatus(status string, full bool) (Status, error)

ParseStatus will parse a status command output into a struct If full is true, it will also parse the address/port of the player. This only works for status commands via RCON/CLI.

Jump to

Keyboard shortcuts

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