Documentation ¶
Overview ¶
package steamid provides utilities for handling and manipulating SteamIDs
The implementation is based on and compliant with the details from https://developer.valvesoftware.com/wiki/SteamID.
Index ¶
- Constants
- Variables
- type AccountType
- type SteamID
- func (id SteamID) AccountID() uint32
- func (id SteamID) AccountInstance() uint32
- func (id SteamID) AccountType() AccountType
- func (id SteamID) MarshalText() (text []byte, err error)
- func (id SteamID) SteamID2() string
- func (id SteamID) SteamID3() string
- func (id SteamID) String() string
- func (id SteamID) Universe() uint8
- func (id *SteamID) UnmarshalText(text []byte) (err error)
Constants ¶
const ( UniverseUnspecified = 0 UniversePublic = 1 UniverseBeta = 2 UniverseInternal = 3 UniverseDev = 4 UniverseRC = 5 )
Universes
See https://developer.valvesoftware.com/wiki/SteamID#Universes_Available_for_Steam_Accounts for more information.
Variables ¶
var ErrInvalidSteamID = errors.New("invalid SteamID")
ErrInvalidSteamID is returned when an attempt is made to parse an invalid SteamID.
Functions ¶
This section is empty.
Types ¶
type AccountType ¶
type AccountType uint8
AccountType represents a Steam account type.
For more information about account types, see https://developer.valvesoftware.com/wiki/SteamID#Types_of_Steam_Accounts
const ( AccountTypeInvalid AccountType = 0 AccountTypeIndividual AccountType = 1 AccountTypeMultiseat AccountType = 2 AccountTypeGameServer AccountType = 3 AccountTypeAnonGameServer AccountType = 4 AccountTypePending AccountType = 5 AccountTypeContentServer AccountType = 6 AccountTypeClan AccountType = 7 AccountTypeChat AccountType = 8 AccountTypeP2PSuperSeeder AccountType = 9 AccountTypeAnonUser AccountType = 10 )
The list of known account types
See https://developer.valvesoftware.com/wiki/SteamID#Types_of_Steam_Accounts for more information.
func (AccountType) Modifier ¶
func (a AccountType) Modifier() uint64
Modifier returns the account type's modifier. If the account type does not have a modifier, it returns 0.
Currently the only account types with modifiers are AccountTypeIndividual and AccountTypeClan.
func (AccountType) String ¶
func (a AccountType) String() string
String gives the name of this account type. If the name of this account type isn't known, it returns an empty string.
type SteamID ¶
type SteamID uint64
SteamID represents a single SteamID, including its universe, instance, type, and ID.
See https://developer.valvesoftware.com/wiki/SteamID#As_Represented_in_Computer_Programs for implementation details.
func FromValues ¶
func FromValues(universe uint8, accountInstance uint32, accountType AccountType, accountID uint32) SteamID
FromValues creates a SteamID from the given values.
func Parse ¶
Parse attempts to parse a SteamID from a string via automatic detection of the string's format. If it fails, it will return an invalid SteamID and ErrInvalidSteamID.
func ParseCommunityID ¶
func ParseCommunityID(id uint64, accountType AccountType) SteamID
ParseCommunityID creates a SteamID from a community ID and modifier.
The account type is a non-negative number. The only valid account types for this function are AccountTypeIndividual and AccountTypeClan.
If an invalid account type is given, this function will return an invalid SteamID.
func ParseV2 ¶
ParseV2 attempts to parse a SteamID from the version 2 textual representation. For example, STEAM_0:0:1.
func ParseV3 ¶
ParseV3 attempts to parse a SteamID from the version 3 textual representation. For example, [U:0:2].
func (SteamID) AccountID ¶
AccountID returns the account ID of this SteamID. This is the unique identifier for the account.
func (SteamID) AccountInstance ¶
AccountInstance returns the instance of the account. It is usually 1 for user accounts.
func (SteamID) AccountType ¶
func (id SteamID) AccountType() AccountType
AccountType returns the account type of this SteamID. For more information about account types, see the AccountType type.
func (SteamID) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (SteamID) SteamID2 ¶
SteamID2 returns the version 2 textual representation of this SteamID. For example, STEAM_0:0:1.
When a SteamID type can not be turned into a version 2 ID, it returns an empty string.
func (SteamID) SteamID3 ¶
SteamID3 returns the version 3 textual representation of this SteamID. For example, [U:1:2].
When a SteamID type can not be turned into a version 3 ID, it returns an empty string.
func (SteamID) String ¶
String returns a string representation of this SteamID. It attempts to use a version 2 SteamID first, then a version 3 SteamID, and finally the raw representation of this SteamID. The last of those can not be parsed by Parse.
func (SteamID) Universe ¶
Universe returns the universe of this SteamID.
See https://developer.valvesoftware.com/wiki/SteamID#Universes_Available_for_Steam_Accounts for available universes.
func (*SteamID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler