Documentation
¶
Index ¶
- Constants
- Variables
- func Run()
- type Command
- type ComponentTemplate
- type FactOpSettings
- type Factorio
- type LogHandler
- func (s *LogHandler) ClearNatsConn()
- func (s *LogHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (s *LogHandler) Handle(ctx context.Context, record slog.Record) error
- func (s *LogHandler) SetNatsConn(conn *nats.Conn)
- func (s *LogHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (s *LogHandler) WithGroup(name string) slog.Handler
- type Nats
- type Rcon
- type ServerState
- type Service
- type Settings
- type SoftMod
- type UDPBridge
- type WebServer
Constants ¶
View Source
const ( SettingsDirectory = "/opt/factorio/settings" FactOpSettingsPath = 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 DefaultShutdownTimeout = 30 * time.Second
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 ¶
Types ¶
type ComponentTemplate ¶
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 FactOpSettings ¶
type FactOpSettings struct {
Port string `json:"Port,omitzero"`
SaveLocation string `json:"SaveLocation,omitzero"`
FactorioVersion string `json:"FactorioVersion,omitzero"`
GamePort int `json:"GamePort,omitzero"`
RconBind string `json:"RconBind,omitzero"`
UDPIncoming int `json:"UDPIncoming,omitzero"`
UDPOutgoing int `json:"UDPOutgoing,omitzero"`
}
type Factorio ¶
type LogHandler ¶ added in v0.1.0
func (*LogHandler) ClearNatsConn ¶ added in v0.1.4
func (s *LogHandler) ClearNatsConn()
func (*LogHandler) SetNatsConn ¶ added in v0.1.4
func (s *LogHandler) SetNatsConn(conn *nats.Conn)
type Nats ¶
type Nats struct {
slog.Logger
LogHandler *LogHandler
// contains filtered or unexported fields
}
func (*Nats) PublishMsg ¶
type Rcon ¶
type ServerState ¶ added in v0.1.4
type ServerState int
ServerState represents the lifecycle state of the Factorio server process.
const ( StateStopped ServerState = iota // No process running StateStarting // cmd.Start() called, waiting for RCON marker StateRunning // RCON marker detected, server accepting commands StateStopping // Interrupt sent, waiting for process exit StateError // Unexpected process exit )
func (ServerState) String ¶ added in v0.1.4
func (s ServerState) String() string
type Service ¶
type Settings ¶
type Settings struct {
*slog.Logger `bind:"-"`
Data FactOpSettings `bind:"-"`
}
type UDPBridge ¶ added in v0.1.0
type UDPBridge struct {
slog.Logger
Context context.Context
Nats *Nats
Settings *Settings
// contains filtered or unexported fields
}
UDPBridge bridges factorio udp_send and udp_rec traffic to and from NATS
Source Files
¶
Click to show internal directories.
Click to hide internal directories.