Documentation ¶
Overview ¶
Package botsession implements marshaling of Bot Session protos.
Index ¶
- Constants
- func Create(params SessionParameters) *internalspb.Session
- func DebugInfo(ctx context.Context, backendVer string) *internalspb.DebugInfo
- func FormatForDebug(s *internalspb.Session) string
- func Marshal(s *internalspb.Session, secret *hmactoken.Secret) ([]byte, error)
- func Unmarshal(tok []byte, secret *hmactoken.Secret) (*internalspb.Session, error)
- type SessionParameters
Constants ¶
View Source
const Expiry = time.Hour
Expiry is how long a new Swarming session token will last.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(params SessionParameters) *internalspb.Session
Create initializes a new Session proto for an authorized connecting bot.
Assumes all parameters have been validated already.
func DebugInfo ¶
func DebugInfo(ctx context.Context, backendVer string) *internalspb.DebugInfo
DebugInfo generates new DebugInfo proto identifying the current request.
func FormatForDebug ¶
func FormatForDebug(s *internalspb.Session) string
FormatForDebug formats the session proto for the debug log.
Types ¶
type SessionParameters ¶
type SessionParameters struct { // SessionID is the new session's ID as reported by the bot. SessionID string // BotID is the bot ID as reported by the bot. BotID string // BotGroup is the matching bot group config as looked up from bots.cfg. BotGroup *cfg.BotGroup // RBEConfig is the matching bot RBE config as looked up from pools.cfg. RBEConfig cfg.RBEConfig // ServerConfig is the config instance used to look up BotGroup and RBEConfig. ServerConfig *cfg.Config // DebugInfo to put into the session proto. DebugInfo *internalspb.DebugInfo // Now is the current time to use to calculate the expiration timestamp. Now time.Time }
SessionParameters encapsulates arguments of Create function.
Click to show internal directories.
Click to hide internal directories.