Help us shape the future of Go! Take the 2026 Go Developer Survey

minibox

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const ShutdownTimeout = 10 * time.Second

Variables

View Source
var ErrServiceNotConfigured = errors.New("service is not configured") // +checklocksignore
View Source
var ErrServiceRunning = errors.New("service is already running") // +checklocksignore
View Source
var ErrServiceStopped = errors.New("service is already stopped") // +checklocksignore
View Source
var ErrStopping = errors.New("stopping service") // +checklocksignore

Functions

This section is empty.

Types

type AdminOptions

type AdminOptions struct {
	Logger zerolog.Logger
	Addr   string
}

type AdminServer

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

func NewAdmin

func NewAdmin(ctx context.Context) *AdminServer

func (*AdminServer) Configure

func (w *AdminServer) Configure(opts AdminOptions) error

func (*AdminServer) Running

func (w *AdminServer) Running() bool

func (*AdminServer) Start

func (w *AdminServer) Start() error

func (*AdminServer) Stop

func (w *AdminServer) Stop() error

type DataOptions

type DataOptions struct {
	DatabaseURI string `json:"URI"`
}

type GameOptions

type GameOptions struct {
	Logger          zerolog.Logger
	Addr            string
	TopologyClient  topologypbconnect.TopologyServiceClient
	AccountsService *accounts.Service
	PangyaIFF       *iff.Archive
	ServerID        uint32
	ChannelName     string
}

type GameServer

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

func NewGameServer

func NewGameServer(ctx context.Context) *GameServer

func (*GameServer) Configure

func (g *GameServer) Configure(opts GameOptions) error

func (*GameServer) Running

func (g *GameServer) Running() bool

func (*GameServer) Start

func (g *GameServer) Start() error

func (*GameServer) Stop

func (g *GameServer) Stop() error

type LoginOptions

type LoginOptions struct {
	Logger          zerolog.Logger
	Addr            string
	TopologyClient  topologypbconnect.TopologyServiceClient
	AccountsService *accounts.Service
}

type LoginServer

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

func NewLoginServer

func NewLoginServer(ctx context.Context) *LoginServer

func (*LoginServer) Configure

func (l *LoginServer) Configure(opts LoginOptions) error

func (*LoginServer) Running

func (l *LoginServer) Running() bool

func (*LoginServer) Start

func (l *LoginServer) Start() error

func (*LoginServer) Stop

func (l *LoginServer) Stop() error

type MessageOptions

type MessageOptions struct {
	Logger          zerolog.Logger
	Addr            string
	TopologyClient  topologypbconnect.TopologyServiceClient
	AccountsService *accounts.Service
}

type MessageServer

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

func NewMessageServer

func NewMessageServer(ctx context.Context) *MessageServer

func (*MessageServer) Configure

func (m *MessageServer) Configure(opts MessageOptions) error

func (*MessageServer) Running

func (m *MessageServer) Running() bool

func (*MessageServer) Start

func (m *MessageServer) Start() error

func (*MessageServer) Stop

func (m *MessageServer) Stop() error

type Options

type Options struct {
	WebAddr         string `json:"WebAddr"`
	AdminAddr       string `json:"AdminAddr"`
	QAAuthAddr      string `json:"QAAuthAddr"`
	LoginAddr       string `json:"LoginAddr"`
	GameAddr        string `json:"GameAddr"`
	MessageAddr     string `json:"MessageAddr"`
	ServerIP        string `json:"ServerIP"`
	GameServerName  string `json:"GameServerName"`
	GameChannelName string `json:"GameChannelName"`
	PangyaRegion    string `json:"PangyaRegion"`
	PangyaDir       string `json:"PangyaDir"`
	PangyaIFF       string `json:"PangyaIFF"`
}

func (*Options) ShouldConfigureAdmin

func (options *Options) ShouldConfigureAdmin(newOpts Options) bool

ShouldConfigureAdmin returns true if the options changed require the admin server to be re-configured.

func (*Options) ShouldConfigureGame

func (options *Options) ShouldConfigureGame(newOpts Options) bool

ShouldConfigureGame returns true if the options changed require the game server to be re-configured.

func (*Options) ShouldConfigureLogin

func (options *Options) ShouldConfigureLogin(newOpts Options) bool

ShouldConfigureLogin returns true if the options changed require the login server to be re-configured.

func (*Options) ShouldConfigureMessage

func (options *Options) ShouldConfigureMessage(newOpts Options) bool

ShouldConfigureMessage returns true if the options changed require the message server to be re-configured.

func (*Options) ShouldConfigureQAAuth

func (options *Options) ShouldConfigureQAAuth(newOpts Options) bool

ShouldConfigureQAAuth returns true if the options changed require the QA auth server to be re-configured.

func (*Options) ShouldConfigureTopology

func (options *Options) ShouldConfigureTopology(newOpts Options) bool

ShouldConfigureMessage returns true if the options changed require the message server to be re-configured.

func (*Options) ShouldConfigureWeb

func (options *Options) ShouldConfigureWeb(newOpts Options) bool

ShouldConfigureWeb returns true if the options changed require the webserver to be re-configured.

func (*Options) ShouldRedetectPangyaKey

func (options *Options) ShouldRedetectPangyaKey(newOpts Options) bool

ShouldRedetectPangyaKey returns true if the options changed require the PangYa key to be re-detected.

type QAAuthOptions

type QAAuthOptions struct {
	Logger zerolog.Logger
	Addr   string
}

type QAAuthServer

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

func NewQAAuth

func NewQAAuth(ctx context.Context) *QAAuthServer

func (*QAAuthServer) Configure

func (q *QAAuthServer) Configure(opts QAAuthOptions) error

func (*QAAuthServer) Running

func (q *QAAuthServer) Running() bool

func (*QAAuthServer) Start

func (q *QAAuthServer) Start() error

func (*QAAuthServer) Stop

func (q *QAAuthServer) Stop() error

type RugburnOptions

type RugburnOptions struct {
	Logger    zerolog.Logger
	PangyaDir string
}

type RugburnPatcher

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

func NewRugburnPatcher

func NewRugburnPatcher() *RugburnPatcher

func (*RugburnPatcher) Configure

func (p *RugburnPatcher) Configure(opts RugburnOptions)

func (*RugburnPatcher) HaveOriginal

func (p *RugburnPatcher) HaveOriginal() bool

func (*RugburnPatcher) Patch

func (p *RugburnPatcher) Patch() error

func (*RugburnPatcher) RugburnVersion

func (p *RugburnPatcher) RugburnVersion() (string, error)

func (*RugburnPatcher) Unpatch

func (p *RugburnPatcher) Unpatch() error

type Server

type Server struct {

	// Network services
	// +checklocks:mu
	Topology *TopologyServer
	// +checklocks:mu
	Web *WebServer
	// +checklocks:mu
	Admin *AdminServer
	// +checklocks:mu
	Login *LoginServer
	// +checklocks:mu
	Game *GameServer
	// +checklocks:mu
	Message *MessageServer
	// +checklocks:mu
	QAAuth *QAAuthServer

	// Misc
	// +checklocks:mu
	Rugburn *RugburnPatcher
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, log zerolog.Logger) *Server

func (*Server) ConfigureDatabase

func (server *Server) ConfigureDatabase(opts DataOptions) error

ConfigureDatabase configures the database, including running pending migrations. If the services are already configured, it will also re-run service configuration with the last configuration.

func (*Server) ConfigureServices

func (server *Server) ConfigureServices(opts Options) error

ConfigureServices reconfigures services. You must successfully configure the database before running this.

type Service

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

func NewService

func NewService(ctx context.Context) *Service

func (*Service) Configure

func (s *Service) Configure(spawn ServiceSpawnFunc) error

func (*Service) ConfigureContext

func (s *Service) ConfigureContext(shutdownCtx context.Context, spawn ServiceSpawnFunc) error

func (*Service) Running

func (s *Service) Running() bool

func (*Service) SetShutdownFunc

func (s *Service) SetShutdownFunc(shutdown ServiceShutdownFunc)

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop() error

func (*Service) StopContext

func (s *Service) StopContext(shutdownCtx context.Context) error

type ServiceShutdownFunc

type ServiceShutdownFunc func(shutdownCtx context.Context) error

type ServiceSpawnFunc

type ServiceSpawnFunc func(ctx context.Context, service *Service)

type TopologyServer

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

func NewLocalTopology

func NewLocalTopology(ctx context.Context) *TopologyServer

func (*TopologyServer) Client

func (*TopologyServer) Configure

func (t *TopologyServer) Configure(opts TopologyServerOptions) error

func (*TopologyServer) Running

func (t *TopologyServer) Running() bool

func (*TopologyServer) Start

func (t *TopologyServer) Start() error

func (*TopologyServer) Stop

func (t *TopologyServer) Stop() error

type TopologyServerOptions

type TopologyServerOptions struct {
	Logger zerolog.Logger

	ServerIP       string
	GameServerName string

	GamePort    uint16
	MessagePort uint16
}

type WebOptions

type WebOptions struct {
	Logger          zerolog.Logger
	Addr            string
	PangyaKey       pyxtea.Key
	PangyaDir       string
	AccountsService *accounts.Service
}

type WebServer

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

func NewWeb

func NewWeb(ctx context.Context) *WebServer

func (*WebServer) Configure

func (w *WebServer) Configure(opts WebOptions) error

func (*WebServer) Running

func (w *WebServer) Running() bool

func (*WebServer) Start

func (w *WebServer) Start() error

func (*WebServer) Stop

func (w *WebServer) Stop() error

Jump to

Keyboard shortcuts

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