enforcerui

package
v0.0.0-...-08df64e Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	TypePolicyUpdate       = "policy.update"
	TypeLeaseUpdate        = "lease.update"
	TypeEnforcementUpdate  = "enforcement.update"
	TypeProcessTermination = "process.termination"
)

Message Types

Variables

This section is empty.

Functions

This section is empty.

Types

type EnforcementUpdate

type EnforcementUpdate struct {
	Running []lease.Properties `json:"running,omitempty"`
	Waiting []lease.Properties `json:"waiting,omitempty"`
}

EnforcementUpdate reports on the current state of enforcement.

type LeaseUpdate

type LeaseUpdate struct {
	Old lease.Set `json:"old,omitempty"`
	New lease.Set `json:"new,omitempty"`
}

LeaseUpdate stores a lease set update.

type Message

type Message struct {
	Type        string            `json:"type"`
	Policies    PolicyUpdate      `json:"policy,omitempty"`
	Leases      LeaseUpdate       `json:"leases,omitempty"`
	Enforcement EnforcementUpdate `json:"enforcement,omitempty"`
	ProcTerm    ProcTerm          `json:"procTerm,omitempty"`
}

Message is a UI message.

type Notice

type Notice struct {
	Title   string
	Message string
}

Notice is a message sent to a session user via the action center.

type PolicyUpdate

type PolicyUpdate struct {
	Old policy.Set `json:"old,omitempty"`
	New policy.Set `json:"new,omitempty"`
}

PolicyUpdate stores a policy set update.

type ProcTerm

type ProcTerm struct {
	Name string `json:"name"`
}

ProcTerm indicates that one of the user's processes has been terminated.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads user interface messages from an underlying reader.

func NewReader

func NewReader(r io.Reader) Reader

NewReader returns a new user interface message reader.

func (Reader) Read

func (r Reader) Read() (Message, error)

Read returns the next message from r, or an error.

type State

type State struct {
	Policies policy.Set
	Leases   lease.Set
	Running  []lease.Properties
}

State holds a snapshot of enforcer state that is relevant to the UI.

func (State) Summary

func (s State) Summary() string

Summary returns a single-line text summary of the state.

type Tray

type Tray struct {
	// contains filtered or unexported fields
}

Tray is an enforcer system tray agent.

func NewTray

func NewTray(icon *walk.Icon, name, version string) *Tray

NewTray returns a new system tray instance.

func (*Tray) Notify

func (t *Tray) Notify(notice Notice)

Notify causes the tray to send a notification.

func (*Tray) Start

func (t *Tray) Start() error

Start causes the tray to begin operation.

func (*Tray) Stop

func (t *Tray) Stop() error

Stop instructs the tray to cease operation and waits for it to close.

The tray will stop automatically if its state channel is closed.

func (*Tray) Update

func (t *Tray) Update(state State)

Update updates the state of the tray.

type UI

type UI struct {
	// contains filtered or unexported fields
}

UI is responsible for running the enforcement user interface for the current user.

func New

func New(icon *walk.Icon, name, version string) (*UI, error)

New returns creates and starts a new UI instance.

It is the caller's responsiblity to call Close when finished with the UI.

func (*UI) Close

func (ui *UI) Close() error

Close stops the user interface and releases any resources consumed by it.

func (*UI) Handle

func (ui *UI) Handle(msg Message)

Handle instructs the user interface to take action on the given message.

If the UI is not running the message will be dropped. If the UI is overloaded this call can block until the UI makes room in its queue.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer writes messages to an underlying writer.

func NewWriter

func NewWriter(w io.Writer) Writer

NewWriter returns a new user interface message writer.

func (Writer) Write

func (w Writer) Write(msg Message) error

Read returns the next message from r, or an error.

Jump to

Keyboard shortcuts

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