server

package
v0.0.0-...-6b508d1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Faucet

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

func NewFaucet

func NewFaucet(client *ethclient.Client, auth *bind.TransactOpts) *Faucet

func (*Faucet) Drip

func (f *Faucet) Drip(to common.Address, amount *big.Int) (common.Hash, error)

type LobbyEntry

type LobbyEntry struct {
	Players      []common.Address
	LastActivity time.Time
}

func (*LobbyEntry) GetPlayers

func (l *LobbyEntry) GetPlayers() []common.Address

type LobbyRegistry

type LobbyRegistry struct {
	Lobbies map[string]*LobbyEntry
	// contains filtered or unexported fields
}

func NewLobbyRegistry

func NewLobbyRegistry() *LobbyRegistry

NewLobbyRegistry creates a new lobby registry.

func (*LobbyRegistry) AddPlayer

func (r *LobbyRegistry) AddPlayer(lobbyId string, player common.Address) error

AddPlayer adds a player to the specified lobby. Returns an error if the lobby does not exist.

func (*LobbyRegistry) Cleanup

func (r *LobbyRegistry) Cleanup(inactivityDuration time.Duration)

func (*LobbyRegistry) GetPlayerAddresses

func (r *LobbyRegistry) GetPlayerAddresses(lobbyId string) ([]common.Address, bool)

GetLobby retrieves a lobby by its ID. It returns false if the lobby does not exist.

func (*LobbyRegistry) NewLobby

func (r *LobbyRegistry) NewLobby() string

NewLobby creates a new lobby and returns its ID.

func (*LobbyRegistry) StartCleanupScheduler

func (r *LobbyRegistry) StartCleanupScheduler(ctx context.Context, inactivityDuration time.Duration, interval time.Duration)

type Server

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

func NewServer

func NewServer(config ServerConfig, rpc *ethclient.Client) (*Server, error)

func (*Server) Run

func (s *Server) Run() error

type ServerConfig

type ServerConfig struct {
	BaseURL               string
	PortStr               string
	RpcURL                string
	GameFactoryAddressHex string
	FaucetPrivateKeyHex   string
	TemplateDir           string
	StaticDir             string
	WasmURL               string
}

func (*ServerConfig) Validate

func (c *ServerConfig) Validate() error

Jump to

Keyboard shortcuts

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