proxy

package
v0.0.0-...-7ae529c Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityData

type ActivityData struct {
	Name    string `json:"gameMode"` // For pvp
	EndTime int64  `json:"endTime"`
}

ActivityData for multiplayer data (specifically PvP). Updated on every multiplayer gamemode round

type CharacterData

type CharacterData struct {
	ID    int64  `json:"character1Id"`
	Level int64  `json:"character1Lv"` // Character lv -1
	Name  string `json:"character1Nm"`
}

CharacterData for data related to the first character of the first team. Updated on every resource check

type GameState

type GameState struct {
	Player    *PlayerData
	Startup   *StartupData
	Character *CharacterData
	Activity  *ActivityData
	Hooks     map[string]func(state *GameState)
}

GameState holds data related to the game state obtained via the proxy

func (*GameState) AddHook

func (gs *GameState) AddHook(key string, fn func(state *GameState)) error

AddHook adds a hook function that will be executed with the game state pointer when the state is updated

func (*GameState) RemoveHook

func (gs *GameState) RemoveHook(key string) error

RemoveHook removes an existing hook function with the given key

type Options

type Options struct {
	LogPath  string
	LogFlags int
	Port     int
}

Options for Proxy initialization

type PlayerData

type PlayerData struct {
	PlayerID  string `json:"playerId"`
	AppID     string `json:"appId"`
	GameWorld string `json:"gameWorld"`
}

PlayerData for data related to the player. Updated on every login/resource check

type Proxy

type Proxy struct {
	Options *Options
	Server  *goproxy.ProxyHttpServer
	State   *GameState
	log.Logger
}

Proxy struct contains server Options, the Server instance and the GameState updated by the proxy

func NewProxy

func NewProxy(options *Options) *Proxy

NewProxy returns a proxy instance and generates a key pair if not present in executable directory

func (*Proxy) Start

func (p *Proxy) Start()

Start the proxy.

type StartupData

type StartupData struct {
	StartTime int64 `json:"modTime"`
}

StartupData for setting the initial login time. Updated on every login

Jump to

Keyboard shortcuts

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