management

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidIssuer            = errors.New("invalid issuer")
	ErrInvalidAudience          = errors.New("invalid audience")
	ErrInvalidJWKSURL           = errors.New("invalid jwks url")
	ErrInvalidRequiredScope     = errors.New("invalid required scope")
	ErrInvalidGuardedPortsRange = errors.New("invalid guarded ports range")
	ErrInvalidIface             = errors.New("invalid network interface")
	ErrInvalidHandshakeWindow   = errors.New("invalid handshake window")
	ErrInvalidInactiveTimer     = errors.New("invalid inactive timer")
	ErrInvalidAccessToken       = errors.New("invalid access token")
	ErrAuthorizationUnavailable = errors.New("authorization unavailable")
	ErrInvalidBootstrapToken    = errors.New("invalid bootstrap token")
	ErrBootstrapLocked          = errors.New("management settings are locked")
	ErrBootstrapNotConfigured   = errors.New("management bootstrap is not configured")
	ErrSettingsNotFound         = errors.New("management settings not found")
)

Functions

This section is empty.

Types

type Options

type Options struct {
	BootstrapToken        string
	RuntimeApplier        RuntimeApplier
	RuntimeStatusProvider RuntimeStatusProvider
}

type Repository

type Repository interface {
	SaveSettings(ctx context.Context, settings Settings) (StoredSettings, error)
	LoadSettings(ctx context.Context) (StoredSettings, error)
}

Repository — это контракт хранилища для настроек управления.

type RuntimeApplier

type RuntimeApplier interface {
	Apply(ctx context.Context, settings Settings) error
}

RuntimeApplier применяет runtime настройки к активному процессу.

type RuntimeStatus

type RuntimeStatus struct {
	Attached bool
	Iface    string
}

RuntimeStatus описывает состояние runtime для того, к чему будет применяться фильтрация.

type RuntimeStatusProvider

type RuntimeStatusProvider interface {
	RuntimeStatus(ctx context.Context) RuntimeStatus
}

RuntimeStatusProvider выводит динамическое состояние runtime приложения.

type Service

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

Service координирует проверку, хранение и авторизацию настроек управления.

func New

func New(repository Repository, verifier Verifier, options Options) *Service

New создает новый сервис управления.

func (*Service) AuthorizeAllow

func (s *Service) AuthorizeAllow(ctx context.Context, accessToken string) error

AuthorizeAllow валидирует JWT access token.

func (*Service) AuthorizeSettingsBootstrap

func (s *Service) AuthorizeSettingsBootstrap(ctx context.Context, bootstrapToken string) error

AuthorizeSettingsBootstrap проверяет одноразовый bootstrap-токен для первоначальной настройки.

func (*Service) GetSettings

func (s *Service) GetSettings(ctx context.Context) (StoredSettings, error)

GetSettings читает текущие настройки управления из репозитория (БД).

func (*Service) RuntimeStatus

func (s *Service) RuntimeStatus(ctx context.Context) RuntimeStatus

RuntimeStatus возвращает состояние динамической BPF-конфигурации во время выполнения.

func (*Service) SaveSettings

func (s *Service) SaveSettings(ctx context.Context, settings Settings) (StoredSettings, error)

SaveSettings проверяет настройки управления, верифицирует JWKS-провайдер и сохраняет настройки в репозитории (БД).

func (*Service) UpdateSettings

func (s *Service) UpdateSettings(ctx context.Context, settings Settings) (StoredSettings, error)

UpdateSettings обновляет существующие настройки управления. Возвращает ErrSettingsNotFound, если настройки управления еще не были сконфигурированы.

type Settings

type Settings struct {
	Issuer             string
	Audience           string
	JWKSURL            string
	RequiredScope      string
	GuardedPortsRange  string
	Iface              string
	HandshakeWindowSec int
	InactiveTimerSec   int
}

Settings описывает настройки присылаемые внешней системой при интеграции.

type StoredSettings

type StoredSettings struct {
	Settings

	UpdatedAt time.Time
	Runtime   RuntimeStatus
}

StoredSettings описывает настройки хранящиеся в БД.

type UseCase

type UseCase interface {
	SaveSettings(ctx context.Context, settings Settings) (StoredSettings, error)
	UpdateSettings(ctx context.Context, settings Settings) (StoredSettings, error)
	GetSettings(ctx context.Context) (StoredSettings, error)
	RuntimeStatus(ctx context.Context) RuntimeStatus
	AuthorizeAllow(ctx context.Context, accessToken string) error
	AuthorizeSettingsBootstrap(ctx context.Context, bootstrapToken string) error
}

UseCase — это контракт приложения для настроек управления.

type Verifier

type Verifier interface {
	ValidateSettings(ctx context.Context, settings Settings) error
	VerifyAccessToken(ctx context.Context, settings Settings, accessToken string) error
}

Verifier проверяет JWT-токены доступа на соответствие настроек управления.

Jump to

Keyboard shortcuts

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