access

package
v0.0.0-...-81dc835 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Event

type Event struct {
	Timestamp time.Time `json:"time"`
	RemoteIP  string    `json:"ip,omitempty"`
	UserAgent string    `json:"user_agent,omitempty"`
}

func NewEvent

func NewEvent(timestamp time.Time, remoteIP httputil.RemoteIP, userAgentString httputil.UserAgentString) Event

type EventProvider

type EventProvider struct {
	Store EventStore
}

func (*EventProvider) InitStream

func (p *EventProvider) InitStream(ctx context.Context, sessionID string, expiry time.Time, initialAccess *Event) error

func (*EventProvider) RecordAccess

func (p *EventProvider) RecordAccess(ctx context.Context, sessionID string, expiry time.Time, event *Event) error

type EventStore

type EventStore interface {
	// AppendEvent appends an access event to the session event stream
	AppendEvent(ctx context.Context, sessionID string, expiry time.Time, e *Event) error
	// ResetEventStream resets a session event stream
	ResetEventStream(ctx context.Context, sessionID string) error
}

type EventStoreRedis

type EventStoreRedis struct {
	Redis *appredis.Handle
	AppID config.AppID
}

func (*EventStoreRedis) AppendEvent

func (s *EventStoreRedis) AppendEvent(ctx context.Context, sessionID string, expiry time.Time, event *Event) error

func (*EventStoreRedis) ResetEventStream

func (s *EventStoreRedis) ResetEventStream(ctx context.Context, sessionID string) error

type Info

type Info struct {
	InitialAccess Event `json:"initial_access"`
	LastAccess    Event `json:"last_access"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL