GameSpy

package
v0.0.0-...-b9423a0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: AGPL-3.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CrcLookup = []rune{}/* 256 elements not displayed */

CrcLookup table "for some sort of hashing thing what was this"

Functions

func BF2Random

func BF2Random(randomLen int, source rand.Source) string

BF2Random generates a random string with valid BF2 random chars https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang/31832326

func BF2RandomUnsafe

func BF2RandomUnsafe(randomLen int) string

BF2RandomUnsafe is a not thread-safe version of BF2Random For thread-safety you should use BF2Random with your own seed

func DecodePassword

func DecodePassword(pass string) (string, error)

DecodePassword decodes gamespy's base64 string used for passwords to a cleantext string

func Hash

func Hash(text string) string

Hash returns the MD5 hash as a hex-string

func Inet_aton

func Inet_aton(ip net.IP) int64

func Inet_ntoa

func Inet_ntoa(ipnr int64) net.IP

func ProcessFESL

func ProcessFESL(data string) map[string]string

func SerializeFESL

func SerializeFESL(data map[string]string) string

func ShortHash

func ShortHash(str string) string

ShortHash returns a MD5 hash of "str" reduced to 12 chars.

Types

type Client

type Client struct {
	IsActive bool

	RedisState *core.RedisState
	IpAddr     net.Addr
	State      ClientState
	FESL       bool
	// contains filtered or unexported fields
}

func (*Client) Close

func (client *Client) Close()

func (*Client) New

func (client *Client) New(name string, conn *net.Conn) (chan ClientEvent, error)

New creates a new Client and starts up the handling of the connection

func (*Client) Write

func (client *Client) Write(command string) error

func (*Client) WriteError

func (client *Client) WriteError(code string, message string) error

WriteError Handy for informing the user they're a piece of shit.

func (*Client) WriteFESL

func (client *Client) WriteFESL(msgType string, msg map[string]string, msgType2 uint32) error

type ClientEvent

type ClientEvent struct {
	Name string
	Data interface{}
}

ClientEvent is the generic struct for events by this Client

type ClientState

type ClientState struct {
	GameName        string
	ServerChallenge string
	ClientChallenge string
	ClientResponse  string
	BattlelogID     int
	Username        string
	PlyName         string
	PlyEmail        string
	PlyCountry      string
	PlyPid          int
	Sessionkey      int
	Confirmed       bool
	Banned          bool
	IpAddress       net.Addr
	HasLogin        bool
	ProfileSent     bool
	LoggedOut       bool
	HeartTicker     *time.Ticker
}

type ClientTLS

type ClientTLS struct {
	IsActive   bool
	IpAddr     net.Addr
	RedisState *core.RedisState
	State      ClientTLSState
	FESL       bool
	// contains filtered or unexported fields
}

func (*ClientTLS) Close

func (clientTLS *ClientTLS) Close()

func (*ClientTLS) New

func (clientTLS *ClientTLS) New(name string, conn *tls.Conn) (chan ClientTLSEvent, error)

New creates a new ClientTLS and starts up the handling of the connection

func (*ClientTLS) WriteFESL

func (clientTLS *ClientTLS) WriteFESL(msgType string, msg map[string]string, msgType2 uint32) error

type ClientTLSEvent

type ClientTLSEvent struct {
	Name string
	Data interface{}
}

ClientTLSEvent is the generic struct for events by this ClientTLS

type ClientTLSState

type ClientTLSState struct {
	GameName           string
	ServerChallenge    string
	ClientTLSChallenge string
	ClientTLSResponse  string
	BattlelogID        int
	Username           string
	PlyName            string
	PlyEmail           string
	PlyCountry         string
	PlyPid             int
	Sessionkey         int
	Confirmed          bool
	Banned             bool
	IpAddress          net.Addr
	HasLogin           bool
	ProfileSent        bool
	LoggedOut          bool
	HeartTicker        *time.Ticker
}

type Command

type Command struct {
	Message map[string]string
	Query   string
}

Command struct

func ProcessCommand

func ProcessCommand(msg string) (*Command, error)

ProcessCommand turns gamespy's command string to the command struct

type CommandFESL

type CommandFESL struct {
	Message   map[string]string
	Query     string
	PayloadID uint32
}

type EventClientClose

type EventClientClose struct {
	Client *Client
}

type EventClientCommand

type EventClientCommand struct {
	Client  *Client
	Command *Command
}

type EventClientData

type EventClientData struct {
	Client *Client
	Data   string
}

type EventClientError

type EventClientError struct {
	Client *Client
	Error  error
}

type EventClientFESLCommand

type EventClientFESLCommand struct {
	Client  *Client
	Command *CommandFESL
}

type EventClientTLSClose

type EventClientTLSClose struct {
	Client *ClientTLS
}

type EventClientTLSCommand

type EventClientTLSCommand struct {
	Client  *ClientTLS
	Command *CommandFESL
}

type EventClientTLSData

type EventClientTLSData struct {
	Client *ClientTLS
	Data   string
}

type EventClientTLSError

type EventClientTLSError struct {
	Client *ClientTLS
	Error  error
}

type EventError

type EventError struct {
	Error error
}

type EventNewClient

type EventNewClient struct {
	Client *Client
}

type EventNewClientTLS

type EventNewClientTLS struct {
	Client *ClientTLS
}

type Socket

type Socket struct {
	Clients []*Client
	// contains filtered or unexported fields
}

Socket is a basic event-based TCP-Server

func (*Socket) Close

func (socket *Socket) Close()

Close fires a close-event and closes the socket

func (*Socket) New

func (socket *Socket) New(name string, port string, fesl bool) (chan SocketEvent, error)

New starts to listen on a new Socket

type SocketEvent

type SocketEvent struct {
	Name string
	Data interface{}
}

SocketEvent is the generic struct for events by this socket

Current events:

Name				-> Data-Type
close 				-> nil
error				-> error
newClient			-> *Client
client.close		-> [0: *client, 1:nil]
client.error		-> [0: *client, error]
client.command		-> [0: *client, *Command]
client.command.*	-> [0: *client, *Command]
client.data			-> [0: *client, string]

type SocketTLS

type SocketTLS struct {
	ClientsTLS []*ClientTLS
	// contains filtered or unexported fields
}

Socket is a basic event-based TCP-Server

func (*SocketTLS) Close

func (socket *SocketTLS) Close()

Close fires a close-event and closes the socket

func (*SocketTLS) New

func (socket *SocketTLS) New(name string, port string, tlsCert string, tlsKey string) (chan SocketEvent, error)

New starts to listen on a new Socket

type SocketUDP

type SocketUDP struct {
	Clients []*Client
	// contains filtered or unexported fields
}

Socket is a basic event-based TCP-Server

func (*SocketUDP) Close

func (socket *SocketUDP) Close()

Close fires a close-event and closes the socket

func (*SocketUDP) New

func (socket *SocketUDP) New(name string, port string, fesl bool) (chan SocketUDPEvent, error)

New starts to listen on a new Socket

func (*SocketUDP) Write

func (socket *SocketUDP) Write(message string, addr *net.UDPAddr)

func (*SocketUDP) WriteFESL

func (socket *SocketUDP) WriteFESL(msgType string, msg map[string]string, msgType2 uint32, addr *net.UDPAddr) error

func (*SocketUDP) XOr

func (socket *SocketUDP) XOr(a []byte) []byte

XOr applies the gamespy XOr

type SocketUDPEvent

type SocketUDPEvent struct {
	Name string
	Addr *net.UDPAddr
	Data interface{}
}

Jump to

Keyboard shortcuts

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