Documentation
¶
Index ¶
- Variables
- type Options
- type Repository
- type RuntimeApplier
- type RuntimeStatus
- type RuntimeStatusProvider
- type Service
- func (s *Service) AuthorizeAllow(ctx context.Context, accessToken string) error
- func (s *Service) AuthorizeSettingsBootstrap(ctx context.Context, bootstrapToken string) error
- func (s *Service) GetSettings(ctx context.Context) (StoredSettings, error)
- func (s *Service) RuntimeStatus(ctx context.Context) RuntimeStatus
- func (s *Service) SaveSettings(ctx context.Context, settings Settings) (StoredSettings, error)
- func (s *Service) UpdateSettings(ctx context.Context, settings Settings) (StoredSettings, error)
- type Settings
- type StoredSettings
- type UseCase
- type Verifier
Constants ¶
This section is empty.
Variables ¶
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") ErrInvalidAccessToken = errors.New("invalid access token") 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 ¶
RuntimeApplier применяет runtime настройки к активному процессу.
type RuntimeStatus ¶
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 ¶
AuthorizeAllow валидирует JWT access token.
func (*Service) AuthorizeSettingsBootstrap ¶
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 ¶
SaveSettings проверяет настройки управления, верифицирует JWKS-провайдер и сохраняет настройки в репозитории (БД).
func (*Service) UpdateSettings ¶
UpdateSettings обновляет существующие настройки управления. Возвращает ErrSettingsNotFound, если настройки управления еще не были сконфигурированы.
type Settings ¶
type Settings struct {
Issuer string
Audience string
JWKSURL string
RequiredScope string
GuardedPortsRange string
Iface string
HandshakeWindowSec 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 — это контракт приложения для настроек управления.