Documentation
¶
Index ¶
Constants ¶
const SessionKey = "eve-session"
SessionKey is the key for the cookie in the HTTP header
const UserContextKey key = "user"
UserContextKey is the key for the user data that is stored in the request context
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GetBotFromRequest ¶
GetBotFromRequest checks if there is a bot id in the request (HTTP GET e.g. ?bot=2) It also checks if the bot belongs to the authenticated user If no bot id is provided in the request the first bot for the user is returned If an error occures or there is no bot in the request or database nil is returned
func GetUserFromRequest ¶
GetUserFromRequest extracts the user stored in the request context If no user is stored, nil is returned
func StartWebServer ¶
StartWebServer creates a handler for incomming http requests on the given host and port The method only returns if the server is shut down or runs into an error