Documentation ¶
Index ¶
Constants ¶
View Source
const ( AuthHeaderDevice = "Device-17" AuthHeaderToken = "Token-17" AuthHeaderNextToken = "Next-Token-17" AuthHeaderNextTokenDeprecated = "Next_token_17" )
View Source
const ( CAAuthenticateURL = "/authenticate" CAProfileURL = "/user/profile" CAGetTokensURL = "/tokens" )
View Source
const ( CHAuthenticateURL = "/v1/authenticate" CHUserProfileURL = "/v1/user_profile" )
View Source
const ( // UserStateNone is only used within Portmaster for saving information for // logging into the same device. UserStateNone = "" UserStateFresh = "fresh" UserStateQueued = "queued" UserStateApproved = "approved" UserStateSuspended = "suspended" UserStateLoggedOut = "loggedout" // Portmaster only. SubscriptionStatePending = "pending" SubscriptionStateActive = "active" SubscriptionStateCancelled = "cancelled" SubscriptionStateExpired = "expired" ChargeStatePending = "pending" ChargeStateCompleted = "completed" ChargeStateDead = "dead" )
User, Subscription and Charge states.
View Source
const ( // StatusInvalidAuth [401 Unauthorized] is returned when the credentials are // invalid or the user was logged out. StatusInvalidAuth = 401 // StatusInvalidDevice [404 Not Found] is returned when the device trying to // log into does not exist. StatusInvalidDevice = 404 // StatusReachedDeviceLimit [409 Conflict] is returned when the device limit is reached. StatusReachedDeviceLimit = 409 // StatusDeviceInactive [423 Locked] is returned when the device is locked. StatusDeviceInactive = 423 // StatusNotLoggedIn [412 Precondition] is returned by the Portmaster, if an action required to be logged in, but the user is not logged in. StatusNotLoggedIn = 412 )
Agent and Hub return statuses.
Variables ¶
View Source
var ( ErrMissingDeviceID = errors.New("missing device ID") ErrMissingToken = errors.New("missing token") )
Functions ¶
func ApplyNextTokenToResponse ¶
func ApplyNextTokenToResponse(w http.ResponseWriter, token string)
Types ¶
type AuthToken ¶
func GetAuthTokenFromRequest ¶
type Plan ¶
type Plan struct { Name string `json:"name"` Amount int `json:"amount"` Months int `json:"months"` Renewable bool `json:"renewable"` }
Plan describes an SPN subscription plan.
type Subscription ¶
Subscription describes an SPN subscription.
type User ¶
type User struct { Username string `json:"username"` State string `json:"state"` Balance int `json:"balance"` Device *Device `json:"device"` Subscription *Subscription `json:"subscription"` CurrentPlan *Plan `json:"current_plan"` NextPlan *Plan `json:"next_plan"` }
User describes an SPN user account.
Click to show internal directories.
Click to hide internal directories.