Documentation
¶
Index ¶
- Constants
- Variables
- func IsRateLimited(err error) bool
- func RegisterTyped[TReq any, TResp any](r *rpc.Router, typeID uint32, gate *Gate, meta *session.Meta, ...)
- func RequireRPC(gate *Gate, meta *session.Meta, policy RPCAccessPolicy) error
- func RetryAfter(err error) time.Duration
- type AttemptPolicy
- type AttemptPolicyStep
- type Gate
- func (g *Gate) CanResumeMeta(resumeToken string, meta session.Meta) bool
- func (g *Gate) Enabled() bool
- func (g *Gate) IsChannelUnlocked(channelID string) bool
- func (g *Gate) IsLocalSessionValid(token string) bool
- func (g *Gate) MintLocalSession(password string) (*LocalSessionResult, error)
- func (g *Gate) MintLocalSessionFromResumeToken(resumeToken string, meta session.Meta) (*LocalSessionResult, error)
- func (g *Gate) MintLocalSessionWithSubject(password string, subject string) (*LocalSessionResult, error)
- func (g *Gate) RegisterChannel(meta session.Meta)
- func (g *Gate) RegisterChannelWithOptions(meta session.Meta, opts RegisterChannelOptions)
- func (g *Gate) ResumeChannel(channelID string, resumeToken string) error
- func (g *Gate) RevokeLocalSession(token string)
- func (g *Gate) RevokeResumeToken(resumeToken string)
- func (g *Gate) Status(channelID string) Status
- func (g *Gate) UnlockChannel(channelID string, password string) (*UnlockResult, error)
- func (g *Gate) UnlockChannelWithSubject(channelID string, password string, subject string) (*UnlockResult, error)
- func (g *Gate) UnregisterChannel(channelID string)
- func (g *Gate) VerifyPassword(password string) bool
- type LocalSessionResult
- type Options
- type RPCAccessPolicy
- type RateLimitError
- type RegisterChannelOptions
- type Status
- type UnlockResult
Constants ¶
View Source
const ( DefaultResumeTTL = 12 * time.Hour DefaultLocalSessionTTL = 12 * time.Hour LocalSessionCookieName = "redeven_local_access" )
View Source
const DefaultFailedAttemptRetention = 30 * time.Minute
Variables ¶
View Source
var ErrInvalidPassword = errors.New("invalid password")
Functions ¶
func IsRateLimited ¶
func RegisterTyped ¶
func RequireRPC ¶
func RequireRPC(gate *Gate, meta *session.Meta, policy RPCAccessPolicy) error
func RetryAfter ¶
Types ¶
type AttemptPolicy ¶
type AttemptPolicy struct {
Steps []AttemptPolicyStep
Retention time.Duration
}
type AttemptPolicyStep ¶
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
func (*Gate) CanResumeMeta ¶
func (*Gate) IsChannelUnlocked ¶
func (*Gate) IsLocalSessionValid ¶
func (*Gate) MintLocalSession ¶
func (g *Gate) MintLocalSession(password string) (*LocalSessionResult, error)
func (*Gate) MintLocalSessionFromResumeToken ¶
func (*Gate) MintLocalSessionWithSubject ¶
func (g *Gate) MintLocalSessionWithSubject(password string, subject string) (*LocalSessionResult, error)
func (*Gate) RegisterChannel ¶
func (*Gate) RegisterChannelWithOptions ¶
func (g *Gate) RegisterChannelWithOptions(meta session.Meta, opts RegisterChannelOptions)
func (*Gate) ResumeChannel ¶
func (*Gate) RevokeLocalSession ¶
func (*Gate) RevokeResumeToken ¶
func (*Gate) UnlockChannel ¶
func (g *Gate) UnlockChannel(channelID string, password string) (*UnlockResult, error)
func (*Gate) UnlockChannelWithSubject ¶
func (*Gate) UnregisterChannel ¶
func (*Gate) VerifyPassword ¶
type LocalSessionResult ¶
type RPCAccessPolicy ¶
type RPCAccessPolicy int
const ( RPCAccessProtected RPCAccessPolicy = iota RPCAccessPublic )
type RateLimitError ¶
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type RegisterChannelOptions ¶
type RegisterChannelOptions struct {
Unlocked bool
}
type UnlockResult ¶
Click to show internal directories.
Click to hide internal directories.