service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SettingsDirectory = "/opt/factorio/settings"
	FactOpSettings    = SettingsDirectory + "/factop-settings.json"
	ServerSettings    = SettingsDirectory + "/server-settings.json"
	MapGenSettings    = SettingsDirectory + "/map-gen-settings.json"
	ServerAdminList   = SettingsDirectory + "/server-adminlist.json"
	ServerBanList     = SettingsDirectory + "/server-banlist.json"
)
View Source
const CreateSaveOutput = SaveLocation + "/create-save.log"
View Source
const CurrentSoftMod = SaveLocation + "/softmod.zip"
View Source
const FactorioBinary = FactorioDirectory + "/bin/x64/factorio"
View Source
const FactorioDirectory = "/opt/factorio/current"
View Source
const NewLine = "\n"
View Source
const NewSave = SaveLocation + "/newSave.zip"
View Source
const RconStartupMarker = "Starting RCON interface at IP ADDR"
View Source
const SaveFile = SaveLocation + "/save.zip"
View Source
const SaveLocation = "/opt/factorio/saves"

Variables

View Source
var IgnorePattern = regexp.MustCompile(`(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \[(\w+)] (.+)`)

Functions

func Run

func Run()

Types

type Command

type Command struct {
	slog.Logger
	Nats     *Nats
	Factorio *Factorio
}

func (*Command) Startup added in v0.1.0

func (c *Command) Startup() error

type ComponentTemplate

type ComponentTemplate struct {
	slog.Logger
}

ComponentTemplate is a template for creating new components

func (*ComponentTemplate) Shutdown added in v0.1.0

func (c *ComponentTemplate) Shutdown() error

func (*ComponentTemplate) Startup added in v0.1.0

func (c *ComponentTemplate) Startup() error

type Factorio

type Factorio struct {
	slog.Logger
	Nats    *Nats
	SoftMod *SoftMod

	Port         int
	RconBind     string
	RconPassword string
	// contains filtered or unexported fields
}

func (*Factorio) Reset

func (f *Factorio) Reset() error

func (*Factorio) Restart

func (f *Factorio) Restart() error

func (*Factorio) Shutdown added in v0.1.0

func (f *Factorio) Shutdown() error

func (*Factorio) Startup added in v0.1.0

func (f *Factorio) Startup() error

func (*Factorio) Status

func (f *Factorio) Status() string

type LogHandler added in v0.1.0

type LogHandler struct {
	Logger service.Logger
}

func (*LogHandler) Enabled added in v0.1.0

func (s *LogHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*LogHandler) Handle added in v0.1.0

func (s *LogHandler) Handle(ctx context.Context, record slog.Record) error

func (*LogHandler) WithAttrs added in v0.1.0

func (s *LogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*LogHandler) WithGroup added in v0.1.0

func (s *LogHandler) WithGroup(name string) slog.Handler

type Nats

type Nats struct {
	slog.Logger
	// contains filtered or unexported fields
}

func (*Nats) Publish

func (n *Nats) Publish(s string, bytes []byte)

func (*Nats) PublishMsg

func (n *Nats) PublishMsg(m *nats.Msg)

func (*Nats) Reply added in v0.1.0

func (n *Nats) Reply(in *nats.Msg, payload []byte, err error)

func (*Nats) Shutdown added in v0.1.0

func (n *Nats) Shutdown() error

func (*Nats) Startup added in v0.1.0

func (n *Nats) Startup() error

func (*Nats) Subscribe

func (n *Nats) Subscribe(subject string, handler nats.MsgHandler) error

type Rcon

type Rcon struct {
	slog.Logger
	Nats     *Nats
	Factorio *Factorio
	// contains filtered or unexported fields
}

func (*Rcon) Shutdown added in v0.1.0

func (r *Rcon) Shutdown() error

func (*Rcon) Startup added in v0.1.0

func (r *Rcon) Startup() error

type Service

type Service struct {
	servicego.Defaults

	Context context.Context
	Cancel  context.CancelFunc
	// contains filtered or unexported fields
}

func (*Service) Start

func (sv *Service) Start(s kservice.Service) error

func (*Service) Stop

func (sv *Service) Stop(_ kservice.Service) error

type Settings

type Settings struct{}

func (*Settings) Startup added in v0.1.0

func (s *Settings) Startup() error

type SoftMod

type SoftMod struct {
	slog.Logger
}

func (*SoftMod) Apply added in v0.1.0

func (sm *SoftMod) Apply(data []byte) error

type UDPBridge added in v0.1.0

type UDPBridge struct {
	slog.Logger
	Context context.Context
	Nats    *Nats
	// contains filtered or unexported fields
}

UDPBridge bridges factorio udp_send and udp_rec traffic to and from NATS

func (*UDPBridge) Shutdown added in v0.1.0

func (u *UDPBridge) Shutdown() error

func (*UDPBridge) Startup added in v0.1.0

func (u *UDPBridge) Startup() error

type WebServer

type WebServer struct {
	slog.Logger
	// contains filtered or unexported fields
}

func (*WebServer) ServeHTTP

func (w *WebServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*WebServer) Shutdown added in v0.1.0

func (w *WebServer) Shutdown() error

func (*WebServer) Startup added in v0.1.0

func (w *WebServer) Startup() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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