matchmaker

package
v0.0.0-...-55e4e00 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Localhost             = "127.0.0.1"
	DefaultGameserverPort = 7777

	DefaultMatchmakingURL = "wss://apex.pixovr.com"
	MatchmakingEndpoint   = "matchmake"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchDetails

type MatchDetails struct {
	IP             string `json:"IPAddress,omitempty"`
	Port           string `json:"Port,omitempty"`
	SessionName    string `json:"SessionName,omitempty"`
	SessionID      string `json:"SessionID,omitempty"`
	MapName        string `json:"MapName,omitempty"`
	OwningUserName string `json:"OwningUserName,omitempty"`
	ModuleVersion  string `json:"ServerVersion,omitempty"`
	ModuleID       int    `json:"ModuleID,omitempty"`
	OrgID          int    `json:"OrgID,omitempty"`
}

type MatchRequest

type MatchRequest struct {
	ModuleID      int    `json:"moduleId"`
	ServerVersion string `json:"serverVersion"`
}

func (MatchRequest) IsValid

func (m MatchRequest) IsValid() bool

type MatchResponse

type MatchResponse struct {
	Error        bool         `json:"error,omitempty"`
	Message      string       `json:"message,omitempty"`
	MatchDetails MatchDetails `json:"matchDetails,omitempty"`
}

func (MatchResponse) IsValid

func (m MatchResponse) IsValid() bool

type Matchmaker

type Matchmaker interface {
	abstract_client.AbstractClient
	FindMatch(req MatchRequest) (*net.UDPAddr, error)

	DialMatchmaker() (*websocket.Conn, *http.Response, error)
	SendRequest(conn *websocket.Conn, req MatchRequest) error
	ReadResponse(conn *websocket.Conn) (MatchResponse, error)
	CloseMatchmakerConnection(conn *websocket.Conn) error

	DialGameserver(addr *net.UDPAddr) error
	CloseGameserverConnection() error
	SendAndReceiveMessage(message []byte) ([]byte, error)
}

type MockMatchmaker

type MockMatchmaker struct {
	abstract_client.MockAbstractClient
	NumCalledFindMatch       int
	NumCalledDialGameserver  int
	NumCalledSendAndReceive  int
	NumCalledCloseGameserver int
	// contains filtered or unexported fields
}

func NewMockMatchmaker

func NewMockMatchmaker() *MockMatchmaker

func (*MockMatchmaker) CloseGameserverConnection

func (m *MockMatchmaker) CloseGameserverConnection() error

func (*MockMatchmaker) CloseMatchmakerConnection

func (m *MockMatchmaker) CloseMatchmakerConnection(conn *websocket.Conn) error

func (*MockMatchmaker) DialGameserver

func (m *MockMatchmaker) DialGameserver(addr *net.UDPAddr) error

func (*MockMatchmaker) DialMatchmaker

func (m *MockMatchmaker) DialMatchmaker() (*websocket.Conn, *http.Response, error)

func (*MockMatchmaker) FindMatch

func (m *MockMatchmaker) FindMatch(request MatchRequest) (*net.UDPAddr, error)

func (*MockMatchmaker) ReadResponse

func (m *MockMatchmaker) ReadResponse(conn *websocket.Conn) (MatchResponse, error)

func (*MockMatchmaker) SendAndReceiveMessage

func (m *MockMatchmaker) SendAndReceiveMessage(message []byte) ([]byte, error)

func (*MockMatchmaker) SendRequest

func (m *MockMatchmaker) SendRequest(conn *websocket.Conn, req MatchRequest) error

type MultiplayerMatchmaker

type MultiplayerMatchmaker struct {
	*abstractClient.AbstractServiceClient
	// contains filtered or unexported fields
}

func NewMatchmaker

func NewMatchmaker(config urlfinder.ClientConfig, timeoutSeconds ...int) *MultiplayerMatchmaker

func NewMatchmakerWithBasicAuth

func NewMatchmakerWithBasicAuth(username, password string, config urlfinder.ClientConfig, timeoutSeconds ...int) (*MultiplayerMatchmaker, error)

func (*MultiplayerMatchmaker) CloseGameserverConnection

func (m *MultiplayerMatchmaker) CloseGameserverConnection() error

func (*MultiplayerMatchmaker) CloseMatchmakerConnection

func (m *MultiplayerMatchmaker) CloseMatchmakerConnection(conn *websocket.Conn) error

func (*MultiplayerMatchmaker) DialGameserver

func (m *MultiplayerMatchmaker) DialGameserver(addr *net.UDPAddr) error

func (*MultiplayerMatchmaker) DialMatchmaker

func (m *MultiplayerMatchmaker) DialMatchmaker() (*websocket.Conn, *http.Response, error)

func (*MultiplayerMatchmaker) FindMatch

func (m *MultiplayerMatchmaker) FindMatch(req MatchRequest) (*net.UDPAddr, error)

func (*MultiplayerMatchmaker) Login

func (m *MultiplayerMatchmaker) Login(username, password string) error

func (*MultiplayerMatchmaker) ReadResponse

func (m *MultiplayerMatchmaker) ReadResponse(conn *websocket.Conn) (MatchResponse, error)

func (*MultiplayerMatchmaker) SendAndReceiveMessage

func (m *MultiplayerMatchmaker) SendAndReceiveMessage(message []byte) ([]byte, error)

func (*MultiplayerMatchmaker) SendRequest

func (m *MultiplayerMatchmaker) SendRequest(conn *websocket.Conn, req MatchRequest) error

Jump to

Keyboard shortcuts

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