service

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemberStatusActive   = "ACTIVE"
	MemberStatusDisabled = "DISABLED"
)

Variables

View Source
var ErrConflict = errors.New("conflict")
View Source
var ErrForbidden = errors.New("forbidden")
View Source
var ErrInvalidInput = errors.New("invalid input")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrQuotaExceeded = errors.New("quota exceeded")

Functions

This section is empty.

Types

type AgentAuthResult

type AgentAuthResult struct {
	OrganizationID          string
	AgentType               string
	AgentID                 string
	RegisteredWithToken     bool
	RegistrationTokenID     string
	AgentCredentialID       string
	AgentCredential         string
	AgentCredentialFileHint string
}

type AgentConfig

type AgentConfig = agent.ConfigSnapshot

func EmptyNodeAgentConfig

func EmptyNodeAgentConfig(nodeID string) AgentConfig

type AgentConfigCompiler

type AgentConfigCompiler interface {
	Compile(ctx context.Context, input AgentConfigInput) (AgentConfig, error)
}

type AgentConfigInput

type AgentConfigInput struct {
	NodeID     string
	NodeGroups []string
	Rules      []RuleConfig
}

type AgentHelloInput

type AgentHelloInput struct {
	Version   string
	Commit    string
	BuildTime string
}

type AgentRuntimeMetricsInput

type AgentRuntimeMetricsInput struct {
	AgentID    string
	Status     string
	LastSeenAt string
	Metrics    agent.MetricsPayload
}

type AgentTrafficReportInput added in v0.1.18

type AgentTrafficReportInput struct {
	ReportID string
	Deltas   []agent.RuleTrafficDelta
}

type AgentUpdatePolicyInput

type AgentUpdatePolicyInput struct {
	Enabled bool `json:"enabled"`
}

type AgentUpgradeBatchInput

type AgentUpgradeBatchInput struct {
	NodeIDs []string `json:"node_ids"`
}

type Authorizer added in v0.1.11

type Authorizer interface {
	HasPermission(identity InternalIdentity, permission string) bool
	AllowedNodeGroupIDs(identity InternalIdentity, requestedAccess string) map[string]bool
	EnsureCanDelegateRoleScopes(ctx context.Context, repositories repo.Repositories, identity InternalIdentity, scopes []repo.ResourceScopeRecord) error
}

type BasicAgentConfigCompiler

type BasicAgentConfigCompiler struct{}

func (BasicAgentConfigCompiler) Compile

type BootstrapInput

type BootstrapInput struct {
	OrganizationName string
	OrganizationSlug string
	SourceIP         string
}

type ControlService

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

func NewControlService

func NewControlService(store repo.UnitOfWork) *ControlService

func NewControlServiceWithOptions

func NewControlServiceWithOptions(store repo.UnitOfWork, options ControlServiceOptions) *ControlService

func (*ControlService) AcknowledgeNodeAgentConfig

func (service *ControlService) AcknowledgeNodeAgentConfig(ctx context.Context, organizationID string, nodeID string, configVersion int, status string, errorMessage string) error

func (*ControlService) AddMember added in v0.1.11

func (service *ControlService) AddMember(ctx context.Context, identity InternalIdentity, input MemberMutationInput) (MemberPayload, error)

func (*ControlService) AgentReleaseVersion

func (service *ControlService) AgentReleaseVersion() string

func (*ControlService) AuthenticateAgentToken

func (service *ControlService) AuthenticateAgentToken(ctx context.Context, agentType string, token string) (AgentAuthResult, error)

func (*ControlService) AuthorizeNodeMetricsStream

func (service *ControlService) AuthorizeNodeMetricsStream(ctx context.Context, identity InternalIdentity, nodeID string) error

func (*ControlService) BatchRules

func (service *ControlService) BatchRules(ctx context.Context, identity InternalIdentity, input RuleBatchInput) (RuleBatchResult, error)

func (*ControlService) Bootstrap

func (service *ControlService) Bootstrap(ctx context.Context, identity WebUserIdentity, input BootstrapInput) (SessionResult, error)

func (*ControlService) CompileNodeAgentConfig

func (service *ControlService) CompileNodeAgentConfig(ctx context.Context, organizationID string, nodeID string) (AgentConfig, error)

func (*ControlService) CopyRule

func (service *ControlService) CopyRule(ctx context.Context, identity InternalIdentity, ruleID string, input RuleCopyInput) (RulePayload, error)

func (*ControlService) CreateMonitor

func (service *ControlService) CreateMonitor(ctx context.Context, identity InternalIdentity, input MonitorMutationInput) (MonitorPayload, error)

func (*ControlService) CreateMonitorGroup

func (service *ControlService) CreateMonitorGroup(ctx context.Context, identity InternalIdentity, input GroupMutationInput) (MonitorGroupPayload, error)

func (*ControlService) CreateNode

func (service *ControlService) CreateNode(ctx context.Context, identity InternalIdentity, input NodeMutationInput) (NodePayload, error)

func (*ControlService) CreateNodeGroup

func (service *ControlService) CreateNodeGroup(ctx context.Context, identity InternalIdentity, input GroupMutationInput) (NodeGroupPayload, error)

func (*ControlService) CreateRegistrationToken

func (service *ControlService) CreateRegistrationToken(ctx context.Context, identity InternalIdentity, agentType string, agentID string, input RegistrationTokenInput) (RegistrationTokenPayload, error)

func (*ControlService) CreateRole added in v0.1.11

func (service *ControlService) CreateRole(ctx context.Context, identity InternalIdentity, input RoleMutationInput) (RolePayload, error)

func (*ControlService) CreateRule

func (service *ControlService) CreateRule(ctx context.Context, identity InternalIdentity, input RuleMutationInput) (RulePayload, error)

func (*ControlService) CreateTarget

func (service *ControlService) CreateTarget(ctx context.Context, identity InternalIdentity, input TargetMutationInput) (TargetPayload, error)

func (*ControlService) CreateTargetGroup

func (service *ControlService) CreateTargetGroup(ctx context.Context, identity InternalIdentity, input TargetGroupMutationInput) (TargetGroupPayload, error)

func (*ControlService) DeleteMember added in v0.1.11

func (service *ControlService) DeleteMember(ctx context.Context, identity InternalIdentity, memberID string) error

func (*ControlService) DeleteMonitor

func (service *ControlService) DeleteMonitor(ctx context.Context, identity InternalIdentity, monitorID string) error

func (*ControlService) DeleteMonitorGroup

func (service *ControlService) DeleteMonitorGroup(ctx context.Context, identity InternalIdentity, monitorGroupID string) error

func (*ControlService) DeleteNode

func (service *ControlService) DeleteNode(ctx context.Context, identity InternalIdentity, nodeID string) error

func (*ControlService) DeleteNodeGroup

func (service *ControlService) DeleteNodeGroup(ctx context.Context, identity InternalIdentity, nodeGroupID string) error

func (*ControlService) DeleteRole added in v0.1.11

func (service *ControlService) DeleteRole(ctx context.Context, identity InternalIdentity, roleID string) error

func (*ControlService) DeleteRule

func (service *ControlService) DeleteRule(ctx context.Context, identity InternalIdentity, ruleID string) error

func (*ControlService) DeleteTarget

func (service *ControlService) DeleteTarget(ctx context.Context, identity InternalIdentity, targetID string) error

func (*ControlService) DeleteTargetGroup

func (service *ControlService) DeleteTargetGroup(ctx context.Context, identity InternalIdentity, targetGroupID string) error

func (*ControlService) DisableRule

func (service *ControlService) DisableRule(ctx context.Context, identity InternalIdentity, ruleID string) (RulePayload, error)

func (*ControlService) EnableRule

func (service *ControlService) EnableRule(ctx context.Context, identity InternalIdentity, ruleID string) (RulePayload, error)

func (*ControlService) ExportRules

func (service *ControlService) ExportRules(ctx context.Context, identity InternalIdentity, ruleIDs []string) (RulesExportPayload, error)

func (*ControlService) FinalizeAgentRegistrationDelivery

func (service *ControlService) FinalizeAgentRegistrationDelivery(ctx context.Context, authResult AgentAuthResult) error

func (*ControlService) GetMonitor

func (service *ControlService) GetMonitor(ctx context.Context, identity InternalIdentity, monitorID string) (MonitorPayload, error)

func (*ControlService) GetNode

func (service *ControlService) GetNode(ctx context.Context, identity InternalIdentity, nodeID string) (NodePayload, error)

func (*ControlService) GetRule

func (service *ControlService) GetRule(ctx context.Context, identity InternalIdentity, ruleID string) (RulePayload, error)

func (*ControlService) ImportRules

func (service *ControlService) ImportRules(ctx context.Context, identity InternalIdentity, input RuleImportInput) (RulesImportResult, error)

func (*ControlService) ListMembers added in v0.1.11

func (service *ControlService) ListMembers(ctx context.Context, identity InternalIdentity) ([]MemberPayload, error)

func (*ControlService) ListMonitorGroups

func (service *ControlService) ListMonitorGroups(ctx context.Context, identity InternalIdentity) ([]MonitorGroupPayload, error)

func (*ControlService) ListMonitors

func (service *ControlService) ListMonitors(ctx context.Context, identity InternalIdentity) ([]MonitorPayload, error)

func (*ControlService) ListNodeGroupOptions

func (service *ControlService) ListNodeGroupOptions(ctx context.Context, identity InternalIdentity, accessLevel string) ([]ResourceOption, error)

func (*ControlService) ListNodeGroups

func (service *ControlService) ListNodeGroups(ctx context.Context, identity InternalIdentity) ([]NodeGroupPayload, error)

func (*ControlService) ListNodes

func (service *ControlService) ListNodes(ctx context.Context, identity InternalIdentity) ([]NodePayload, error)

func (*ControlService) ListRegistrationTokens

func (service *ControlService) ListRegistrationTokens(ctx context.Context, identity InternalIdentity, agentType string, agentID string) ([]RegistrationTokenPayload, error)

func (*ControlService) ListRoles added in v0.1.11

func (service *ControlService) ListRoles(ctx context.Context, identity InternalIdentity) ([]RolePayload, error)

func (*ControlService) ListRules

func (service *ControlService) ListRules(ctx context.Context, identity InternalIdentity) ([]RulePayload, error)

func (*ControlService) ListTargetGroups

func (service *ControlService) ListTargetGroups(ctx context.Context, identity InternalIdentity) ([]TargetGroupPayload, error)

func (*ControlService) ListTargets

func (service *ControlService) ListTargets(ctx context.Context, identity InternalIdentity) ([]TargetPayload, error)

func (*ControlService) MarkMonitorAgentConnected

func (service *ControlService) MarkMonitorAgentConnected(ctx context.Context, organizationID string, monitorID string) error

func (*ControlService) MarkMonitorAgentDisconnected

func (service *ControlService) MarkMonitorAgentDisconnected(ctx context.Context, organizationID string, monitorID string) error

func (*ControlService) MarkNodeAgentConnected

func (service *ControlService) MarkNodeAgentConnected(ctx context.Context, organizationID string, nodeID string) error

func (*ControlService) MarkNodeAgentDisconnected

func (service *ControlService) MarkNodeAgentDisconnected(ctx context.Context, organizationID string, nodeID string) error

func (*ControlService) NodeAgentConfigBehind

func (service *ControlService) NodeAgentConfigBehind(ctx context.Context, organizationID string, nodeID string, appliedConfigVersion int) (bool, error)

func (*ControlService) NodeGroupListenIPOptions

func (service *ControlService) NodeGroupListenIPOptions(ctx context.Context, identity InternalIdentity, nodeGroupID string, protocol string, port int) ([]ResourceOption, error)

func (*ControlService) PendingNodeAgentUpdate

func (service *ControlService) PendingNodeAgentUpdate(ctx context.Context, organizationID string, nodeID string) (string, bool, error)

func (*ControlService) RecordNodeAgentHello

func (service *ControlService) RecordNodeAgentHello(ctx context.Context, organizationID string, nodeID string, input AgentHelloInput) (NodePayload, bool, error)

func (*ControlService) RecordNodeAgentUpdateResult

func (service *ControlService) RecordNodeAgentUpdateResult(ctx context.Context, organizationID string, nodeID string, status string, errorMessage string) error

func (*ControlService) RecordNodeTrafficReport added in v0.1.18

func (service *ControlService) RecordNodeTrafficReport(ctx context.Context, organizationID string, nodeID string, input AgentTrafficReportInput) (bool, error)

func (*ControlService) ReleaseAgentRegistrationCredential

func (service *ControlService) ReleaseAgentRegistrationCredential(ctx context.Context, authResult AgentAuthResult) error

func (*ControlService) RequestNodeAgentUpgrade

func (service *ControlService) RequestNodeAgentUpgrade(ctx context.Context, identity InternalIdentity, nodeID string) (NodePayload, error)

func (*ControlService) RequestNodeAgentUpgrades

func (service *ControlService) RequestNodeAgentUpgrades(ctx context.Context, identity InternalIdentity, input AgentUpgradeBatchInput) ([]NodePayload, error)

func (*ControlService) RevokeRegistrationToken

func (service *ControlService) RevokeRegistrationToken(ctx context.Context, identity InternalIdentity, agentType string, agentID string, tokenID string) error

func (*ControlService) RuleDiagnostics

func (service *ControlService) RuleDiagnostics(ctx context.Context, identity InternalIdentity, ruleID string, runtimeStates []AgentRuntimeMetricsInput) (RuleDiagnosticsPayload, error)

func (*ControlService) RuleTraffic

func (service *ControlService) RuleTraffic(ctx context.Context, identity InternalIdentity, ruleID string) (RuleTrafficPayload, error)

func (*ControlService) SessionForInternalIdentity

func (service *ControlService) SessionForInternalIdentity(ctx context.Context, identity InternalIdentity) (SessionResult, error)

func (*ControlService) SessionForWebUser

func (service *ControlService) SessionForWebUser(ctx context.Context, identity WebUserIdentity) (SessionResult, error)

func (*ControlService) TargetGroupOptions

func (service *ControlService) TargetGroupOptions(ctx context.Context, identity InternalIdentity, protocol string) ([]ResourceOption, error)

func (*ControlService) TargetOptions

func (service *ControlService) TargetOptions(ctx context.Context, identity InternalIdentity, protocol string) ([]ResourceOption, error)

func (*ControlService) UpdateMember added in v0.1.11

func (service *ControlService) UpdateMember(ctx context.Context, identity InternalIdentity, memberID string, input MemberMutationInput) (MemberPayload, error)

func (*ControlService) UpdateMonitor

func (service *ControlService) UpdateMonitor(ctx context.Context, identity InternalIdentity, monitorID string, input MonitorMutationInput) (MonitorPayload, error)

func (*ControlService) UpdateMonitorGroup

func (service *ControlService) UpdateMonitorGroup(ctx context.Context, identity InternalIdentity, monitorGroupID string, input GroupMutationInput) (MonitorGroupPayload, error)

func (*ControlService) UpdateNode

func (service *ControlService) UpdateNode(ctx context.Context, identity InternalIdentity, nodeID string, input NodeMutationInput) (NodePayload, error)

func (*ControlService) UpdateNodeAgentUpdatePolicy

func (service *ControlService) UpdateNodeAgentUpdatePolicy(ctx context.Context, identity InternalIdentity, nodeID string, input AgentUpdatePolicyInput) (NodePayload, error)

func (*ControlService) UpdateNodeGroup

func (service *ControlService) UpdateNodeGroup(ctx context.Context, identity InternalIdentity, nodeGroupID string, input GroupMutationInput) (NodeGroupPayload, error)

func (*ControlService) UpdateOrganization

func (service *ControlService) UpdateOrganization(ctx context.Context, identity InternalIdentity, input OrganizationUpdateInput) (OrganizationPayload, error)

func (*ControlService) UpdateRole added in v0.1.11

func (service *ControlService) UpdateRole(ctx context.Context, identity InternalIdentity, roleID string, input RoleMutationInput) (RolePayload, error)

func (*ControlService) UpdateRule

func (service *ControlService) UpdateRule(ctx context.Context, identity InternalIdentity, ruleID string, input RuleMutationInput) (RulePayload, error)

func (*ControlService) UpdateTarget

func (service *ControlService) UpdateTarget(ctx context.Context, identity InternalIdentity, targetID string, input TargetMutationInput) (TargetPayload, error)

func (*ControlService) UpdateTargetGroup

func (service *ControlService) UpdateTargetGroup(ctx context.Context, identity InternalIdentity, targetGroupID string, input TargetGroupMutationInput) (TargetGroupPayload, error)

func (*ControlService) ValidateAgentToken

func (service *ControlService) ValidateAgentToken(ctx context.Context, agentType string, token string) (AgentAuthResult, error)

type ControlServiceOptions

type ControlServiceOptions struct {
	AppName                 string
	ControlPlaneURL         string
	AgentReleaseVersion     string
	AgentTokenSigningSecret []byte
	Edition                 edition.Provider
	Authorizer              Authorizer
	SessionBackend          SessionBackend
	RBACBackend             RBACBackend
	TargetGroupSchedulers   TargetGroupSchedulerSupportFunc
}

type ErrorPayload

type ErrorPayload struct {
	Code    string         `json:"code"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

func ErrorPayloadForError

func ErrorPayloadForError(err error) ErrorPayload

type GroupMutationInput

type GroupMutationInput struct {
	Name        string
	Description string
}

type InternalIdentity

type InternalIdentity struct {
	UserID         string
	OrganizationID string
	MemberID       string
	Roles          []string
	Permissions    []string
	ResourceScopes []ResourceScopePayload
	SourceIP       string
}

type MemberMutationInput

type MemberMutationInput struct {
	Email           string
	RoleIDs         []string
	RoleIDsProvided bool
	Status          string
}

type MemberPayload

type MemberPayload struct {
	ID      string   `json:"id"`
	UserID  string   `json:"user_id"`
	Email   string   `json:"email"`
	Name    string   `json:"name"`
	Status  string   `json:"status"`
	RoleIDs []string `json:"role_ids"`
}

type MonitorGroupPayload

type MonitorGroupPayload struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type MonitorMutationInput

type MonitorMutationInput struct {
	Name             string
	NameProvided     bool
	GroupIDs         []string
	GroupIDsProvided bool
}

type MonitorPayload

type MonitorPayload struct {
	ID                   string   `json:"id"`
	Name                 string   `json:"name"`
	Status               string   `json:"status"`
	DesiredConfigVersion int      `json:"desired_config_version"`
	AppliedConfigVersion int      `json:"applied_config_version"`
	LastSeenAt           string   `json:"last_seen_at,omitempty"`
	RegisteredAt         string   `json:"registered_at,omitempty"`
	GroupIDs             []string `json:"group_ids"`
}

type NodeGroupPayload

type NodeGroupPayload struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type NodeListenIPInput

type NodeListenIPInput struct {
	ListenIP    string
	DisplayName string
}

type NodeListenIPPayload

type NodeListenIPPayload struct {
	ID          string `json:"id,omitempty"`
	ListenIP    string `json:"listen_ip"`
	DisplayName string `json:"display_name"`
	Enabled     bool   `json:"enabled"`
}

type NodeMutationInput

type NodeMutationInput struct {
	Name                      string
	NameProvided              bool
	GroupIDs                  []string
	GroupIDsProvided          bool
	ListenIPs                 []NodeListenIPInput
	ListenIPsProvided         bool
	PortRanges                []NodePortRangeInput
	PortRangesProvided        bool
	PublicDescription         string
	PublicDescriptionProvided bool
}

type NodePayload

type NodePayload struct {
	ID                     string                 `json:"id"`
	Name                   string                 `json:"name"`
	Status                 string                 `json:"status"`
	PublicDescription      string                 `json:"public_description"`
	DesiredConfigVersion   int                    `json:"desired_config_version"`
	AppliedConfigVersion   int                    `json:"applied_config_version"`
	ConfigStatus           string                 `json:"config_status"`
	ConfigErrorMessage     string                 `json:"config_error_message,omitempty"`
	ConfigStatusUpdatedAt  string                 `json:"config_status_updated_at,omitempty"`
	LastSeenAt             string                 `json:"last_seen_at,omitempty"`
	RegisteredAt           string                 `json:"registered_at,omitempty"`
	AgentVersion           string                 `json:"agent_version"`
	AgentCommit            string                 `json:"agent_commit"`
	AgentBuildTime         string                 `json:"agent_build_time"`
	AgentAutoUpdateEnabled bool                   `json:"agent_auto_update_enabled"`
	DesiredAgentVersion    string                 `json:"desired_agent_version"`
	AgentUpdateStatus      string                 `json:"agent_update_status"`
	AgentUpdateError       string                 `json:"agent_update_error,omitempty"`
	AgentUpdateStartedAt   string                 `json:"agent_update_started_at,omitempty"`
	AgentUpdateFinishedAt  string                 `json:"agent_update_finished_at,omitempty"`
	GroupIDs               []string               `json:"group_ids"`
	ListenIPs              []NodeListenIPPayload  `json:"listen_ips"`
	PortRanges             []NodePortRangePayload `json:"port_ranges"`
}

type NodePortRangeInput

type NodePortRangeInput struct {
	Protocol  string
	StartPort int
	EndPort   int
}

type NodePortRangePayload

type NodePortRangePayload struct {
	ID        string `json:"id,omitempty"`
	Protocol  string `json:"protocol"`
	StartPort int    `json:"start_port"`
	EndPort   int    `json:"end_port"`
	Enabled   bool   `json:"enabled"`
}

type OrganizationPayload

type OrganizationPayload struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type OrganizationUpdateInput

type OrganizationUpdateInput struct {
	Name string
	Slug string
}

type PortableRulePayload

type PortableRulePayload struct {
	Name           string                      `json:"name"`
	Tags           []string                    `json:"tags"`
	ForwardingType string                      `json:"forwarding_type"`
	Protocol       string                      `json:"protocol"`
	Port           int                         `json:"port"`
	Match          RuleMatchPayload            `json:"match"`
	ProxyProtocol  RuleProxyProtocolInput      `json:"proxy_protocol"`
	Upstream       PortableRuleUpstreamPayload `json:"upstream"`
}

type PortableRuleUpstreamPayload

type PortableRuleUpstreamPayload struct {
	Type           string `json:"type"`
	TargetRef      string `json:"target_ref,omitempty"`
	TargetGroupRef string `json:"target_group_ref,omitempty"`
}

type PortableTargetGroupMemberPayload

type PortableTargetGroupMemberPayload struct {
	TargetRef string `json:"target_ref"`
	Priority  int    `json:"priority"`
	Enabled   bool   `json:"enabled"`
}

type PortableTargetGroupPayload

type PortableTargetGroupPayload struct {
	Ref         string                             `json:"ref"`
	Name        string                             `json:"name"`
	Description string                             `json:"description"`
	Scheduler   string                             `json:"scheduler"`
	Members     []PortableTargetGroupMemberPayload `json:"members"`
}

type PortableTargetPayload

type PortableTargetPayload struct {
	Ref     string `json:"ref"`
	Name    string `json:"name"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	Enabled bool   `json:"enabled"`
}

type RBACBackend added in v0.1.11

type RBACBackend interface {
	ListMembers(ctx context.Context, identity InternalIdentity) ([]MemberPayload, error)
	AddMember(ctx context.Context, identity InternalIdentity, input MemberMutationInput) (MemberPayload, error)
	UpdateMember(ctx context.Context, identity InternalIdentity, memberID string, input MemberMutationInput) (MemberPayload, error)
	DeleteMember(ctx context.Context, identity InternalIdentity, memberID string) error
	ListRoles(ctx context.Context, identity InternalIdentity) ([]RolePayload, error)
	CreateRole(ctx context.Context, identity InternalIdentity, input RoleMutationInput) (RolePayload, error)
	UpdateRole(ctx context.Context, identity InternalIdentity, roleID string, input RoleMutationInput) (RolePayload, error)
	DeleteRole(ctx context.Context, identity InternalIdentity, roleID string) error
}

type RegistrationTokenInput

type RegistrationTokenInput struct {
	TTLHours int
}

type RegistrationTokenPayload

type RegistrationTokenPayload struct {
	TokenID         string `json:"token_id"`
	Token           string `json:"token,omitempty"`
	AgentType       string `json:"agent_type"`
	AgentID         string `json:"agent_id"`
	ExpiresAt       string `json:"expires_at"`
	UsedAt          string `json:"used_at,omitempty"`
	RevokedAt       string `json:"revoked_at,omitempty"`
	CreatedAt       string `json:"created_at"`
	CreatedByUserID string `json:"created_by_user_id,omitempty"`
	InstallCommand  string `json:"install_command,omitempty"`
}

type ResourceOption

type ResourceOption struct {
	Value          string `json:"value"`
	Label          string `json:"label"`
	Disabled       bool   `json:"disabled"`
	DisabledReason string `json:"disabled_reason,omitempty"`
}

type ResourceScopePayload

type ResourceScopePayload struct {
	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id"`
	AccessLevel  string `json:"access_level"`
}

type RoleMutationInput

type RoleMutationInput struct {
	Name           string
	Description    string
	Permissions    []string
	ResourceScopes []ResourceScopePayload
}

type RolePayload

type RolePayload struct {
	ID             string                 `json:"id"`
	Key            string                 `json:"key"`
	Name           string                 `json:"name"`
	Description    string                 `json:"description"`
	IsSystem       bool                   `json:"is_system"`
	Permissions    []string               `json:"permissions"`
	ResourceScopes []ResourceScopePayload `json:"resource_scopes"`
}

type RuleBatchInput

type RuleBatchInput struct {
	Action  string
	RuleIDs []string
}

type RuleBatchItemResult

type RuleBatchItemResult struct {
	RuleID  string        `json:"rule_id"`
	Status  string        `json:"status"`
	Error   *ErrorPayload `json:"error,omitempty"`
	Warning string        `json:"warning,omitempty"`
}

type RuleBatchResult

type RuleBatchResult struct {
	Action    string                `json:"action"`
	Total     int                   `json:"total"`
	Succeeded int                   `json:"succeeded"`
	Failed    int                   `json:"failed"`
	Results   []RuleBatchItemResult `json:"results"`
}

type RuleConfig

type RuleConfig = agent.RuleConfig

type RuleConnectInfoPayload

type RuleConnectInfoPayload struct {
	Protocol         string   `json:"protocol"`
	ListenPort       int      `json:"listen_port"`
	ListenIP         string   `json:"listen_ip"`
	NodeDescriptions []string `json:"node_descriptions"`
}

type RuleCopyInput

type RuleCopyInput struct {
	Name    string
	Tags    []string
	TagsSet bool
}

type RuleDiagnosticsPayload

type RuleDiagnosticsPayload struct {
	RuleID        string                         `json:"rule_id"`
	GeneratedAt   string                         `json:"generated_at"`
	BandwidthBps  int64                          `json:"bandwidth_bps"`
	UploadBytes   int64                          `json:"upload_bytes"`
	DownloadBytes int64                          `json:"download_bytes"`
	Targets       []RuleTargetDiagnosticsPayload `json:"targets"`
}

type RuleImportEntry

type RuleImportEntry struct {
	NodeGroupID string `json:"node_group_id"`
	ListenIP    string `json:"listen_ip"`
}

type RuleImportInput

type RuleImportInput struct {
	DryRun     bool
	Entry      RuleImportEntry
	Format     string
	SourceText string
}

type RuleImportIssue

type RuleImportIssue struct {
	Code    string         `json:"code"`
	Scope   string         `json:"scope"`
	Index   *int           `json:"index,omitempty"`
	Details map[string]any `json:"details,omitempty"`
}

type RuleMatchInput

type RuleMatchInput struct {
	Type        string
	SNIHostname string
}

type RuleMatchPayload

type RuleMatchPayload struct {
	Type        string `json:"type"`
	SNIHostname string `json:"sni_hostname,omitempty"`
}

type RuleMutationInput

type RuleMutationInput struct {
	Name           string
	Tags           []string
	NodeGroupID    string
	ListenIP       string
	ForwardingType string
	Protocol       string
	Port           int
	Match          RuleMatchInput
	ProxyProtocol  RuleProxyProtocolInput
	Upstream       RuleUpstreamInput
	Enabled        bool
	EnabledSet     bool
}

type RulePayload

type RulePayload struct {
	ID             string                 `json:"id"`
	Name           string                 `json:"name"`
	Status         string                 `json:"status"`
	Enabled        bool                   `json:"enabled"`
	Tags           []string               `json:"tags"`
	NodeGroupID    string                 `json:"node_group_id"`
	ListenIP       string                 `json:"listen_ip"`
	ForwardingType string                 `json:"forwarding_type"`
	Protocol       string                 `json:"protocol"`
	Port           int                    `json:"port"`
	Match          RuleMatchPayload       `json:"match"`
	ProxyProtocol  RuleProxyProtocolInput `json:"proxy_protocol"`
	Upstream       RuleUpstreamInput      `json:"upstream"`
	OwnerUserID    string                 `json:"owner_user_id"`
	ConfigVersion  int                    `json:"config_version"`
	ConnectInfo    RuleConnectInfoPayload `json:"connect_info"`
}

type RuleProxyProtocolInput

type RuleProxyProtocolInput struct {
	In  string `json:"in"`
	Out string `json:"out"`
}

type RuleTargetDiagnosticsPayload

type RuleTargetDiagnosticsPayload struct {
	TargetID            string `json:"target_id"`
	Name                string `json:"name"`
	Address             string `json:"address"`
	Status              string `json:"status"`
	LastSeenAt          string `json:"last_seen_at,omitempty"`
	LatencyMS           *int64 `json:"latency_ms"`
	BandwidthBps        *int64 `json:"bandwidth_bps"`
	UploadBytes         int64  `json:"upload_bytes"`
	DownloadBytes       int64  `json:"download_bytes"`
	TCPConnections      int64  `json:"tcp_connections"`
	UDPPacketsPerSecond int64  `json:"udp_packets_per_second"`
}

type RuleTrafficPayload

type RuleTrafficPayload struct {
	UploadBytes    int64  `json:"upload_bytes"`
	DownloadBytes  int64  `json:"download_bytes"`
	TCPConnections int64  `json:"tcp_connections"`
	UDPPackets     int64  `json:"udp_packets"`
	LimitBytes     int64  `json:"limit_bytes"`
	LimitMode      string `json:"limit_mode"`
}

type RuleUpstreamConfig

type RuleUpstreamConfig = agent.RuleUpstreamConfig

type RuleUpstreamInput

type RuleUpstreamInput struct {
	Type          string `json:"type"`
	TargetID      string `json:"target_id"`
	TargetGroupID string `json:"target_group_id"`
}

type RulesExportPayload

type RulesExportPayload struct {
	SchemaVersion string                       `json:"schema_version"`
	ExportedAt    string                       `json:"exported_at"`
	Rules         []PortableRulePayload        `json:"rules"`
	Targets       []PortableTargetPayload      `json:"targets"`
	TargetGroups  []PortableTargetGroupPayload `json:"target_groups"`
}

type RulesImportResult

type RulesImportResult struct {
	DryRun   bool              `json:"dry_run"`
	Created  int               `json:"created"`
	Skipped  int               `json:"skipped"`
	Errors   []RuleImportIssue `json:"errors"`
	Warnings []RuleImportIssue `json:"warnings"`
}

type SessionBackend added in v0.1.11

type SessionBackend interface {
	Bootstrap(ctx context.Context, identity WebUserIdentity, input BootstrapInput) (SessionResult, error)
	SessionForWebUser(ctx context.Context, identity WebUserIdentity) (SessionResult, error)
	SessionForInternalIdentity(ctx context.Context, identity InternalIdentity) (SessionResult, error)
}

type SessionResult

type SessionResult struct {
	Created        bool                   `json:"created"`
	User           UserPayload            `json:"user"`
	Organization   OrganizationPayload    `json:"organization"`
	Organizations  []OrganizationPayload  `json:"organizations"`
	Member         MemberPayload          `json:"member"`
	Roles          []RolePayload          `json:"roles"`
	Permissions    []string               `json:"permissions"`
	ResourceScopes []ResourceScopePayload `json:"resource_scopes"`
}

type TargetEndpoint

type TargetEndpoint = agent.TargetEndpoint

type TargetGroupMemberInput

type TargetGroupMemberInput struct {
	TargetID string
	Priority int
	Enabled  bool
}

type TargetGroupMemberPayload

type TargetGroupMemberPayload struct {
	TargetID string `json:"target_id"`
	Priority int    `json:"priority"`
	Enabled  bool   `json:"enabled"`
}

type TargetGroupMutationInput

type TargetGroupMutationInput struct {
	Name        string
	Description string
	Scheduler   string
	Members     []TargetGroupMemberInput
}

type TargetGroupPayload

type TargetGroupPayload struct {
	ID          string                     `json:"id"`
	Name        string                     `json:"name"`
	Description string                     `json:"description"`
	Scheduler   string                     `json:"scheduler"`
	Members     []TargetGroupMemberPayload `json:"members"`
}

type TargetGroupSchedulerSupportFunc added in v0.1.15

type TargetGroupSchedulerSupportFunc func(scheduler string) bool

type TargetMutationInput

type TargetMutationInput struct {
	Name                   string
	Host                   string
	Port                   int
	Enabled                bool
	TargetGroupIDs         []string
	TargetGroupIDsProvided bool
}

type TargetPayload

type TargetPayload struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	Enabled bool   `json:"enabled"`
}

type TargetPriorityBucket

type TargetPriorityBucket = agent.TargetPriorityBucket

type UserPayload

type UserPayload struct {
	ID    string `json:"id"`
	Email string `json:"email"`
	Name  string `json:"name"`
}

type WebUserIdentity

type WebUserIdentity struct {
	UserID string
	Email  string
	Name   string
}

Jump to

Keyboard shortcuts

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