eimasterlib

package
v0.0.0-...-b105658 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeWin1251

func DecodeWin1251(encoded []byte) string

func EncodeWin1251

func EncodeWin1251(decoded string) []byte

func ReadGameInfo

func ReadGameInfo(r io.Reader, full bool, game *EIGameInfo) error

func ReadMasterResponse

func ReadMasterResponse(r io.Reader, game *EIGameInfo) error

func ReadServerInfo

func ReadServerInfo(r io.Reader, full bool, srv *EIServerInfo) error

func ReadServersList

func ReadServersList(r io.Reader, full bool, res *[]EIServerInfo) error

func WriteGameInfo

func WriteGameInfo(w io.Writer, full bool, game *EIGameInfo) error

func WriteMasterResponse

func WriteMasterResponse(w io.Writer, game *EIGameInfo) error

func WriteServerInfo

func WriteServerInfo(w io.Writer, full bool, srv *EIServerInfo) error

func WriteServersList

func WriteServersList(w io.Writer, full bool, servers []EIServerInfo) error

Types

type EIGameInfo

type EIGameInfo struct {
	ClientID        uint32   `json:"-"`
	MasterToken     uint32   `json:"-"`
	Name            string   `json:"name"`
	Quest           string   `json:"quest"`
	PlayersCount    uint8    `json:"players_count"`
	MaxPlayersCount uint8    `json:"max_players_count"`
	HasPassword     bool     `json:"has_password"`
	AllodIndex      uint8    `json:"allod_index"`
	PlayerNames     []string `json:"player_names,omitempty"`
}

func (*EIGameInfo) Copy

func (game *EIGameInfo) Copy() *EIGameInfo

Copy makes a full copy of the this EIGameInfo struct

func (*EIGameInfo) IsSentByOrigGame

func (game *EIGameInfo) IsSentByOrigGame() bool

IsSentByOrigGame returns true if this game info looks like produced by original game

type EIServerAddr

type EIServerAddr struct {
	Family uint16
	Data   [14]uint8
}

EIServerAddr represents server address. Maybe it makes sense to get rid of this and use net.Addr instead

func NewEIServerAddr

func NewEIServerAddr(addr *net.UDPAddr) (eiAddr *EIServerAddr, err error)

func (*EIServerAddr) GetUDPAddr

func (addr *EIServerAddr) GetUDPAddr() *net.UDPAddr

func (*EIServerAddr) Read

func (addr *EIServerAddr) Read(r io.Reader) error

func (*EIServerAddr) String

func (addr *EIServerAddr) String() string

func (*EIServerAddr) Write

func (addr *EIServerAddr) Write(w io.Writer) error

type EIServerInfo

type EIServerInfo struct {
	Addr net.UDPAddr `json:"addr"`
	EIGameInfo
	AppearTime         time.Time `json:"appear_time"`
	LastUpdate         time.Time `json:"last_update"`
	Ping               int       `json:"ping"`
	LastSuccessfulPing time.Time `json:"last_successful_ping"`
}

func (*EIServerInfo) Copy

func (srv *EIServerInfo) Copy() *EIServerInfo

Copy makes a full copy of this EIServerInfo struct

func (*EIServerInfo) Equals

func (srv *EIServerInfo) Equals(srv2 *EIServerInfo) bool

func (*EIServerInfo) IP

func (srv *EIServerInfo) IP() string

func (*EIServerInfo) StrictEquals

func (srv *EIServerInfo) StrictEquals(srv2 *EIServerInfo) bool

func (*EIServerInfo) String

func (srv *EIServerInfo) String() string

Jump to

Keyboard shortcuts

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