steamid

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
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.

View Source
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

func FromAccountID(a uint32) ID

FromAccountID builds an ID from a bare 32-bit account id.

func FromID64

func FromID64(n uint64) (ID, error)

FromID64 builds an ID from a 64-bit SteamID. It returns ErrInvalid when n is below the individual-account base.

func Parse

func Parse(input string) (ID, error)

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) ID3

func (id ID) ID3() string

ID3 returns the modern text form, for example "[U:1:22202]".

func (ID) ID64

func (id ID) ID64() uint64

ID64 returns the 64-bit SteamID.

func (ID) ID64String

func (id ID) ID64String() string

ID64String returns the 64-bit SteamID as a decimal string.

func (ID) Steam2

func (id ID) Steam2() string

Steam2 returns the legacy form, for example "STEAM_1:0:11101". The universe digit is 1 (public); the low bit of the account id is the Y field and the rest is the Z field.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL