Documentation
¶
Overview ¶
Package steamid converts between the three SteamID forms with no network call.
Steam identifies an account three ways. The 64-bit SteamID (SteamID64) is the canonical numeric id, for example 76561197960287930. The modern text form, SteamID3, writes the same account as [U:1:22202]. The legacy form, Steam2, writes it as STEAM_1:0:11101. All three encode one 32-bit account id; the conversion is pure arithmetic over that account id and a fixed base, so a caller can translate any form into the others offline.
A vanity name (the custom URL a user picks, like /id/gaben) is not a SteamID and cannot be resolved without the network; Parse reports it as ErrVanity so the caller routes it to the community resolver instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("not a recognizable SteamID")
ErrInvalid is returned by Parse when the input is neither a SteamID form nor a plausible vanity name.
var ErrVanity = errors.New("input is a vanity name, not a SteamID; resolve it over the network")
ErrVanity is returned by Parse when the input is a plausible vanity name rather than a SteamID form. Resolving it needs the network.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID struct {
AccountID uint32
}
ID is one parsed account, printable in every form.
func FromAccountID ¶
FromAccountID builds an ID from a bare 32-bit account id.
func FromID64 ¶
FromID64 builds an ID from a 64-bit SteamID. It returns ErrInvalid when n is below the individual-account base.
func Parse ¶
Parse reads any SteamID form (64-bit, [U:1:N], or STEAM_X:Y:Z) into an ID. A plausible vanity name returns ErrVanity; anything else returns ErrInvalid.
func (ID) ID64String ¶
ID64String returns the 64-bit SteamID as a decimal string.