Documentation
¶
Overview ¶
Package steamid provides types and functions to represent and manipulate a SteamID.
Index ¶
- Constants
- type AccountID
- func (id AccountID) AuthServer() uint32
- func (id AccountID) FormatString() string
- func (id AccountID) ID() uint32
- func (id AccountID) SetAuthServer(value uint32) AccountID
- func (id AccountID) SetID(value uint32) AccountID
- func (id AccountID) SteamID() SteamID
- func (id AccountID) Uint32() uint32
- func (id AccountID) UsesAuthServer() bool
- type AccountInstance
- func (i AccountInstance) ClearChatFlags() AccountInstance
- func (i AccountInstance) HasChatFlag(flag ChatInstanceFlag) bool
- func (i AccountInstance) IsConsole() bool
- func (i AccountInstance) IsDesktop() bool
- func (i AccountInstance) IsWeb() bool
- func (i AccountInstance) SetChatFlags(flags ...ChatInstanceFlag) AccountInstance
- type AccountType
- func (t AccountType) Enum() steamlang.EAccountType
- func (t AccountType) IsAnonGameServer() bool
- func (t AccountType) IsAnonUser() bool
- func (t AccountType) IsChat() bool
- func (t AccountType) IsClan() bool
- func (t AccountType) IsConsoleUser() bool
- func (t AccountType) IsContentServer() bool
- func (t AccountType) IsGameServer() bool
- func (t AccountType) IsIndividual() bool
- func (t AccountType) IsInvalid() bool
- func (t AccountType) IsMultiseat() bool
- func (t AccountType) IsPending() bool
- func (t AccountType) Rune(instance AccountInstance) rune
- type ChatInstanceFlag
- type SteamID
- func (id SteamID) AccountID() AccountID
- func (id SteamID) AccountInstance() AccountInstance
- func (id SteamID) AccountType() AccountType
- func (id SteamID) AccountUniverse() steamlang.EUniverse
- func (id SteamID) ChatToClan() SteamID
- func (id SteamID) ClanToChat() SteamID
- func (id SteamID) FormatString() string
- func (id SteamID) SetAccountID(aid AccountID) SteamID
- func (id SteamID) SetAccountInstance(i AccountInstance) SteamID
- func (id SteamID) SetAccountType(t steamlang.EAccountType) SteamID
- func (id SteamID) SetAccountUniverse(u steamlang.EUniverse) SteamID
- func (id SteamID) Steam2() string
- func (id SteamID) Steam3() string
- func (id SteamID) String() string
- func (id SteamID) Uint64() uint64
Constants ¶
const ( AccountIDOffset uint = 0 AccountIDMask uint64 = 0xFFFFFFFF )
const ( AccountInstanceOffset uint = 32 AccountInstanceMask uint64 = 0xFFFFF )
const ( // ChatInstanceFlagClan is set for clan based chat steam IDs. ChatInstanceFlagClan = ChatInstanceFlag((AccountInstanceMask + 1) >> (iota + 1)) // ChatInstanceFlagLobby is set for lobby based chat steam IDs. ChatInstanceFlagLobby // ChatInstanceFlagMMSLobby is set for matchmaking lobby based chat steam IDs. ChatInstanceFlagMMSLobby )
const ( AccountTypeOffset uint = 52 AccountTypeMask uint64 = 0xF AccountTypeRuneUnknown rune = 'i' )
const ( AccountUniverseOffset uint = 56 AccountUniverseMask uint64 = 0xF )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountID ¶
type AccountID uint32
AccountID represents the "account number" part of a SteamID.
It's a 32-bits field with two parts: the least significant bit indicates wether it account uses authentication or not, the highest 31 bits represent the account number.
func NewAccountID ¶
func (AccountID) AuthServer ¶
func (AccountID) FormatString ¶
func (AccountID) SetAuthServer ¶
func (AccountID) SteamID ¶
SteamID creates a SteamID with this AccountID and default type, universe and instance.
func (AccountID) UsesAuthServer ¶
type AccountInstance ¶
type AccountInstance uint32
AccountInstance is an instance of an account.
It's a 20-bit bitfield where the lowest 17 bits store the `*Instance` flags and the highest 3 bits store the `ChatInstanceFlag*` flags.
const ( // DesktopInstance is the account instance value for a desktop. DesktopInstance AccountInstance = 1 << iota // ConsoleInstance is the account instance value for a console. ConsoleInstance // WebInstance is the account instance value for mobile or web-based. WebInstance )
const (
UnknownInstance AccountInstance = 0
)
func AccountInstanceFromString ¶
func AccountInstanceFromString(s string) (AccountInstance, error)
func (AccountInstance) ClearChatFlags ¶
func (i AccountInstance) ClearChatFlags() AccountInstance
func (AccountInstance) HasChatFlag ¶
func (i AccountInstance) HasChatFlag(flag ChatInstanceFlag) bool
func (AccountInstance) IsConsole ¶
func (i AccountInstance) IsConsole() bool
func (AccountInstance) IsDesktop ¶
func (i AccountInstance) IsDesktop() bool
func (AccountInstance) IsWeb ¶
func (i AccountInstance) IsWeb() bool
func (AccountInstance) SetChatFlags ¶
func (i AccountInstance) SetChatFlags(flags ...ChatInstanceFlag) AccountInstance
type AccountType ¶
type AccountType steamlang.EAccountType
func AccountTypeFromRune ¶
func AccountTypeFromRune(r rune) AccountType
func (AccountType) Enum ¶
func (t AccountType) Enum() steamlang.EAccountType
func (AccountType) IsAnonGameServer ¶
func (t AccountType) IsAnonGameServer() bool
func (AccountType) IsAnonUser ¶
func (t AccountType) IsAnonUser() bool
func (AccountType) IsChat ¶
func (t AccountType) IsChat() bool
func (AccountType) IsClan ¶
func (t AccountType) IsClan() bool
func (AccountType) IsConsoleUser ¶
func (t AccountType) IsConsoleUser() bool
func (AccountType) IsContentServer ¶
func (t AccountType) IsContentServer() bool
func (AccountType) IsGameServer ¶
func (t AccountType) IsGameServer() bool
func (AccountType) IsIndividual ¶
func (t AccountType) IsIndividual() bool
func (AccountType) IsInvalid ¶
func (t AccountType) IsInvalid() bool
func (AccountType) IsMultiseat ¶
func (t AccountType) IsMultiseat() bool
func (AccountType) IsPending ¶
func (t AccountType) IsPending() bool
func (AccountType) Rune ¶
func (t AccountType) Rune(instance AccountInstance) rune
type ChatInstanceFlag ¶
type ChatInstanceFlag uint32
ChatInstanceFlag is a flag a chat SteamID may have.
type SteamID ¶
type SteamID uint64
SteamID is a steam identifier.
func New ¶
func New( accountType steamlang.EAccountType, universe steamlang.EUniverse, accountID AccountID, instance AccountInstance, ) SteamID
New creates a SteamID with explicit parameters.
func Parse ¶
Parse attempts to Parse a SteamID from the given string.
It tries to Parse the string with `ParseSteam2` and if it does not match, tries to Parse the value with `ParseSteam3`.
It returns zero and a nil error if the string does not match any of the formats.
It returns a non-nil error if any of the `ParseSteam*` functions returned a non-nil error.
func ParseSteam2 ¶
ParseSteam2 attempts to parse a SteamID from the given string in the steam2 ID format (`STEAM_X:Y:Z`).
It returns zero and a nil error if the string does not match the steam2 ID format.
It returns a non-nil error if the string matches the steam2 ID format but could not be parsed.
func ParseSteam3 ¶
ParseSteam3 attempts to parse a SteamID from the given string in the Steam3 ID format (`[X:Y:Z:W]`).
In the Steam3 format, the last `:W` part is optional.
It returns zero and a nil error if the string does not match the Steam3 ID format.
It returns a non-nil error if the string matches the Steam3 ID format but could not be parsed.
func (SteamID) AccountInstance ¶
func (id SteamID) AccountInstance() AccountInstance
func (SteamID) AccountType ¶
func (id SteamID) AccountType() AccountType
func (SteamID) AccountUniverse ¶
func (SteamID) ChatToClan ¶
ChatToClan returns a copy of this SteamID with type changed from Chat to Clan and the instance with Chat flags reset.
If the SteamID's type is not Chat, it returns the receiver.
func (SteamID) ClanToChat ¶
ClanToChat returns a copy of this SteamID with type changed from Clan to Chat and the instance flagged with `ChatInstanceFlagClan`.
If the SteamID's type is not Clan, it returns the receiver.
func (SteamID) FormatString ¶
func (SteamID) SetAccountID ¶
func (SteamID) SetAccountInstance ¶
func (id SteamID) SetAccountInstance(i AccountInstance) SteamID
func (SteamID) SetAccountType ¶
func (id SteamID) SetAccountType(t steamlang.EAccountType) SteamID