steam

package module
v0.0.0-...-2e40e0d Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2014 License: MIT Imports: 13 Imported by: 23

README

go-steam

go-steam is a Go library for querying Source servers.

Requirements

  • Go 1.1 or above

Installation

go get github.com/kidoman/go-steam

License

This code is free software; you can redistribute it and/or modify it under the terms of the MIT License. A copy of this license can be found in the included LICENSE file.

Documentation

Overview

Package steam allows querying of Source servers.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRCONAuthFailed = errors.New("steam: authentication failed")

	ErrRCONNotInitialized     = errors.New("steam: rcon is not initialized")
	ErrInvalidResponseType    = errors.New("steam: invalid response type from server")
	ErrInvalidResponseID      = errors.New("steam: invalid response id from server")
	ErrInvalidResponseTrailer = errors.New("steam: invalid response trailer from server")
)

Functions

func SetLog

func SetLog(l *logrus.Logger)

Types

type ConnectOptions

type ConnectOptions struct {
	// Default will use net.Dialer.Dial. You can override the same by
	// providing your own.
	Dial DialFn

	// RCON password.
	RCONPassword string
}

ConnectOptions describes the various connections options.

type DialFn

type DialFn func(network, address string) (net.Conn, error)

type Environment

type Environment int
const (
	EInvalid Environment = iota
	ELinux
	EWindows
	EMac
)

func (Environment) String

func (e Environment) String() string

type InfoResponse

type InfoResponse struct {
	Protocol    int
	Name        string
	Map         string
	Folder      string
	Game        string
	ID          int
	Players     int
	MaxPlayers  int
	Bots        int
	ServerType  ServerType
	Environment Environment
	Visibility  Visibility
	VAC         VAC
	Version     string

	Port    int
	SteamID int64

	SourceTVPort int
	SourceTVName string

	Keywords string
	GameID   int64
}

func (*InfoResponse) String

func (r *InfoResponse) String() string

type Player

type Player struct {
	Name     string
	Score    int
	Duration float64
}

type PlayersInfoResponse

type PlayersInfoResponse struct {
	Players []*Player
}

type Server

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

Server represents a Source engine game server.

func Connect

func Connect(addr string, os ...*ConnectOptions) (_ *Server, err error)

Connect to the source server.

func (*Server) Close

func (s *Server) Close()

Close releases the resources associated with this server.

func (*Server) Info

func (s *Server) Info() (*InfoResponse, error)

Info retrieves server information.

func (*Server) Ping

func (s *Server) Ping() (time.Duration, error)

Ping returns the RTT (round-trip time) to the server.

func (*Server) PlayersInfo

func (s *Server) PlayersInfo() (*PlayersInfoResponse, error)

PlayersInfo retrieves player information from the server.

func (*Server) Send

func (s *Server) Send(cmd string) (string, error)

Send RCON command to the server.

func (*Server) String

func (s *Server) String() string

type ServerType

type ServerType int
const (
	STInvalid ServerType = iota
	STDedicated
	STNonDedicated
	STProxy
)

func (ServerType) String

func (st ServerType) String() string

type VAC

type VAC int
const (
	VACInvalid VAC = iota
	VACUnsecured
	VACSecure
)

func (VAC) String

func (v VAC) String() string

type Visibility

type Visibility int
const (
	VInvalid Visibility = iota
	VPublic
	VPrivate
)

func (Visibility) String

func (v Visibility) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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