ipc

package
v0.0.0-...-1cdf2d7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 66

Documentation

Overview

Package ipc contains types and functions used for interprocess communication between Seesaw components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthGroups

func AuthGroups() []string

AuthGroups returns a list of groups who are permitted to authenticate.

func SetAdminGroup

func SetAdminGroup(g string)

SetAdminGroup sets the admin group.

func SetOperatorGroup

func SetOperatorGroup(g string)

SetOperatorGroup sets the operator group.

func SetReaderGroup

func SetReaderGroup(g string)

SetReaderGroup sets the reader group.

Types

type AuthType

type AuthType int

AuthType specifies the type of authentication established.

const (
	ATNone AuthType = iota
	ATSSO
	ATTrusted
	ATUntrusted
)

Various AuthTypes.

func (AuthType) String

func (at AuthType) String() string

String returns the string representation of an AuthType.

type ConfigSource

type ConfigSource struct {
	Ctx    *Context
	Source string
}

ConfigSource contains data for a config source IPC.

type Context

type Context struct {
	AuthToken string
	AuthType  AuthType
	Groups    []string
	Peer      Peer // Untrusted - client provided
	Proxy     Peer
	User      User
}

Context contains information relating to interprocess communication.

func NewAuthContext

func NewAuthContext(component seesaw.Component, token string) *Context

NewAuthContext returns a new authenticated context for the given component.

func NewContext

func NewContext(component seesaw.Component) *Context

NewContext returns a new context for the given component.

func NewTrustedContext

func NewTrustedContext(component seesaw.Component) *Context

NewTrustedContext returns a new trusted context for the given component.

func (*Context) CanRead

func (ctx *Context) CanRead() bool

CanRead reports whether the context is allowed to read data or config. Either the context is trusted, or the remote user is authenticated and is authorized to read.

func (*Context) CanWrite

func (ctx *Context) CanWrite() bool

CanWrite reports whether the context is allowed to mutate Seesaw state. Either the context is trusted, or the remote user is authenticated and is a member of the admin group.

func (*Context) IsAuthenticated

func (ctx *Context) IsAuthenticated() bool

IsAuthenticated returns whether a context is authenticated.

func (*Context) IsTrusted

func (ctx *Context) IsTrusted() bool

IsTrusted returns whether a context came from a trusted source.

func (*Context) String

func (ctx *Context) String() string

String returns the string representation of a context.

type HAState

type HAState struct {
	Ctx   *Context
	State spb.HaState
}

HAState contains data for a HA state IPC.

type HAStatus

type HAStatus struct {
	Ctx    *Context
	Status seesaw.HAStatus
}

HAStatus contains data for a HA status IPC.

type Override

type Override struct {
	Ctx         *Context
	Vserver     *seesaw.VserverOverride
	Destination *seesaw.DestinationOverride
	Backend     *seesaw.BackendOverride
}

Override contains data for an override IPC.

type Peer

type Peer struct {
	Component seesaw.Component
	Identity  string
}

Peer contains information identifying a peer process.

type User

type User struct {
	Groups   []string
	UID      string
	Username string
}

User contains information identifying a user.

func (User) IsAdmin

func (u User) IsAdmin() bool

IsAdmin returns whether the user has administrative rights.

func (User) IsOperator

func (u User) IsOperator() bool

IsOperator returns whether the user has operator rights (includes admins).

func (User) IsReader

func (u User) IsReader() bool

IsReader returns whether the user has reader rights (includes operators and admins).

func (User) String

func (u User) String() string

String returns the string representation of a user.

Jump to

Keyboard shortcuts

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