Documentation
¶
Overview ¶
Package steamcmd provides a small, safe Go client for SteamCMD.
A Client is intended to be the sole coordinator for one SteamCMD directory. The package serializes operations within a Client, but callers must also coordinate separate processes that use the same directories.
Index ¶
- func ParseBuildID(output string) (string, error)
- type Client
- func (c *Client) AppInfo(ctx context.Context, appID string) ([]byte, error)
- func (c *Client) CheckForUpdate(ctx context.Context, appID string) (UpdateStatus, error)
- func (c *Client) DownloadWorkshopItem(ctx context.Context, options WorkshopDownloadOptions) error
- func (c *Client) ExecutablePath() string
- func (c *Client) Install(ctx context.Context) error
- func (c *Client) InstalledBuildID(appID string) (string, error)
- func (c *Client) LatestBuildID(ctx context.Context, appID string) (string, error)
- func (c *Client) Run(ctx context.Context, args ...string) ([]byte, error)
- func (c *Client) Setup(ctx context.Context, options UpdateOptions) (UpdateResult, error)
- func (c *Client) Update(ctx context.Context, options UpdateOptions) (UpdateResult, error)
- type CommandError
- type CommandRunner
- type Config
- type Downloader
- type Login
- type Platform
- type UpdateOptions
- type UpdateResult
- type UpdateStatus
- type WorkshopDownloadOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBuildID ¶
ParseBuildID extracts the first numeric buildid field from SteamCMD output or a raw app manifest.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client controls one SteamCMD installation and its app directory.
func New ¶
New validates config and creates a Client. Platform defaults to runtime.GOOS when omitted. SteamCMDDir and InstallDir must not overlap.
func (*Client) CheckForUpdate ¶
CheckForUpdate compares the installed manifest with the public build.
func (*Client) DownloadWorkshopItem ¶
func (c *Client) DownloadWorkshopItem(ctx context.Context, options WorkshopDownloadOptions) error
DownloadWorkshopItem downloads one Steam Workshop item.
func (*Client) ExecutablePath ¶
ExecutablePath returns the path to the configured SteamCMD executable.
func (*Client) Install ¶
Install installs SteamCMD if its platform entrypoint is not already a regular executable file.
func (*Client) InstalledBuildID ¶
InstalledBuildID reads the app manifest from InstallDir.
func (*Client) LatestBuildID ¶
LatestBuildID fetches app information and parses its public build ID.
func (*Client) Setup ¶
func (c *Client) Setup(ctx context.Context, options UpdateOptions) (UpdateResult, error)
Setup installs SteamCMD and then performs the requested app update.
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, options UpdateOptions) (UpdateResult, error)
Update performs an app update using an already installed SteamCMD.
type CommandError ¶
type CommandError struct {
Output []byte
Truncated bool
Err error
// contains filtered or unexported fields
}
CommandError reports a failed SteamCMD invocation. Output is bounded by Config.MaxOutputBytes.
func (*CommandError) Error ¶
func (e *CommandError) Error() string
func (*CommandError) Unwrap ¶
func (e *CommandError) Unwrap() error
Unwrap exposes the underlying process or context error.
type CommandRunner ¶
CommandRunner is the command execution seam used by tests and callers that need to provide their own process runner.
type Config ¶
type Config struct {
SteamCMDDir string
InstallDir string
Platform Platform
Login Login
DownloadURLs []string
HTTPClient *http.Client
Downloader Downloader
CommandRunner CommandRunner
Attempts int
RetryBackoff time.Duration
CommandTimeout time.Duration
DownloadTimeout time.Duration
MaxOutputBytes int64
}
Config controls a Client.
type Downloader ¶
Downloader downloads url to destination. The destination is a temporary path when called by Install.
type Login ¶
Login contains the credentials used for SteamCMD commands. An empty Username selects anonymous login.
type UpdateOptions ¶
type UpdateOptions struct {
AppID string
Beta string
BetaPassword string
Validate bool
Force bool
ExtraArgs []string
}
UpdateOptions controls an app update.
type UpdateResult ¶
type UpdateResult struct {
AppID string
PreviousBuildID string
LatestBuildID string
InstalledBuildID string
Updated bool
Verified bool
}
UpdateResult describes an update attempt.
type UpdateStatus ¶
type UpdateStatus struct {
AppID string
PreviousBuildID string
LatestBuildID string
InstalledBuildID string
UpdateAvailable bool
}
UpdateStatus describes whether the installed app differs from the public build reported by SteamCMD.
type WorkshopDownloadOptions ¶
WorkshopDownloadOptions controls a workshop item download.