Documentation
¶
Overview ¶
Package mock provides in-memory test doubles for go-steam internals.
Index ¶
- func EncodeChunk(plaintext, depotKey []byte) ([]byte, error)
- func EncodeManifest(protoBytes []byte) []byte
- type CDNServer
- type Store
- func (s *Store) ClearSession() error
- func (s *Store) LoadDepotKey(depotID uint32) (*store.CachedDepotKey, error)
- func (s *Store) LoadSession() (*store.CachedSession, error)
- func (s *Store) LoadToken(host string, depotID uint32) (*store.CachedToken, error)
- func (s *Store) SaveDepotKey(k store.CachedDepotKey) error
- func (s *Store) SaveSession(sess *store.CachedSession) error
- func (s *Store) SaveToken(t store.CachedToken) error
- func (s *Store) SetDepotKey(depotID uint32, key []byte)
- func (s *Store) SetToken(host string, depotID uint32, token string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeChunk ¶
EncodeChunk AES-ECB-encrypts plaintext with depotKey for use with AddChunk.
func EncodeManifest ¶
EncodeManifest builds a minimal mock manifest payload with a single length-prefixed section (for use with AddManifest).
Types ¶
type CDNServer ¶
type CDNServer struct {
// SimulateErrors counts how many requests fail before succeeding.
SimulateErrors int
// contains filtered or unexported fields
}
CDNServer is an httptest-based mock CDN that serves pre-registered manifests and chunks. It exercises the full AES+LZMA pipeline.
func NewCDNServer ¶
func NewCDNServer() *CDNServer
NewCDNServer creates and starts a mock CDN HTTP server.
func (*CDNServer) AddChunk ¶
AddChunk registers a pre-encoded (AES-ECB encrypted) chunk response. Use EncodeChunk to prepare the bytes.
func (*CDNServer) AddManifest ¶
AddManifest registers a pre-encoded manifest response.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory implementation of the cache interfaces — no disk I/O.
func (*Store) ClearSession ¶
ClearSession removes any stored session.
func (*Store) LoadDepotKey ¶
func (s *Store) LoadDepotKey(depotID uint32) (*store.CachedDepotKey, error)
LoadDepotKey returns the cached key for depotID, or nil.
func (*Store) LoadSession ¶
func (s *Store) LoadSession() (*store.CachedSession, error)
LoadSession returns the stored session if one exists and isn't expired.
func (*Store) SaveDepotKey ¶
func (s *Store) SaveDepotKey(k store.CachedDepotKey) error
SaveDepotKey stores a depot key.
func (*Store) SaveSession ¶
func (s *Store) SaveSession(sess *store.CachedSession) error
SaveSession stores a session.
func (*Store) SaveToken ¶
func (s *Store) SaveToken(t store.CachedToken) error
SaveToken stores a CDN auth token.
func (*Store) SetDepotKey ¶
SetDepotKey is a test helper for pre-seeding a depot key.