reverseproxy

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package reverseproxy is a generated GoMock package.

Index

Constants

View Source
const (
	StatusPending            ProxyStatus = "pending"
	StatusActive             ProxyStatus = "active"
	StatusTunnelNotCreated   ProxyStatus = "tunnel_not_created"
	StatusCertificatePending ProxyStatus = "certificate_pending"
	StatusCertificateFailed  ProxyStatus = "certificate_failed"
	StatusError              ProxyStatus = "error"

	TargetTypePeer   = "peer"
	TargetTypeHost   = "host"
	TargetTypeDomain = "domain"
	TargetTypeSubnet = "subnet"

	SourcePermanent = "permanent"
	SourceEphemeral = "ephemeral"
)

Variables

This section is empty.

Functions

func GenerateExposeName added in v0.66.0

func GenerateExposeName(prefix string) (string, error)

GenerateExposeName generates a random service name for peer-exposed services. The prefix, if provided, must be a valid DNS label component (lowercase alphanumeric and hyphens).

Types

type AuthConfig

type AuthConfig struct {
	PasswordAuth *PasswordAuthConfig `json:"password_auth,omitempty" gorm:"serializer:json"`
	PinAuth      *PINAuthConfig      `json:"pin_auth,omitempty" gorm:"serializer:json"`
	BearerAuth   *BearerAuthConfig   `json:"bearer_auth,omitempty" gorm:"serializer:json"`
}

func (*AuthConfig) ClearSecrets

func (a *AuthConfig) ClearSecrets()

func (*AuthConfig) HashSecrets

func (a *AuthConfig) HashSecrets() error

type BearerAuthConfig

type BearerAuthConfig struct {
	Enabled            bool     `json:"enabled"`
	DistributionGroups []string `json:"distribution_groups,omitempty" gorm:"serializer:json"`
}

type ExposeServiceRequest added in v0.66.0

type ExposeServiceRequest struct {
	NamePrefix string
	Port       int
	Protocol   string
	Domain     string
	Pin        string
	Password   string
	UserGroups []string
}

ExposeServiceRequest contains the parameters for creating a peer-initiated expose service.

func (*ExposeServiceRequest) ToService added in v0.66.0

func (r *ExposeServiceRequest) ToService(accountID, peerID, serviceName string) *Service

ToService builds a Service from the expose request.

func (*ExposeServiceRequest) Validate added in v0.66.0

func (r *ExposeServiceRequest) Validate() error

Validate checks all fields of the expose request.

type ExposeServiceResponse added in v0.66.0

type ExposeServiceResponse struct {
	ServiceName string
	ServiceURL  string
	Domain      string
}

ExposeServiceResponse contains the result of a successful peer expose creation.

type Manager

type Manager interface {
	GetAllServices(ctx context.Context, accountID, userID string) ([]*Service, error)
	GetService(ctx context.Context, accountID, userID, serviceID string) (*Service, error)
	CreateService(ctx context.Context, accountID, userID string, service *Service) (*Service, error)
	UpdateService(ctx context.Context, accountID, userID string, service *Service) (*Service, error)
	DeleteService(ctx context.Context, accountID, userID, serviceID string) error
	DeleteAllServices(ctx context.Context, accountID, userID string) error
	SetCertificateIssuedAt(ctx context.Context, accountID, serviceID string) error
	SetStatus(ctx context.Context, accountID, serviceID string, status ProxyStatus) error
	ReloadAllServicesForAccount(ctx context.Context, accountID string) error
	ReloadService(ctx context.Context, accountID, serviceID string) error
	GetGlobalServices(ctx context.Context) ([]*Service, error)
	GetServiceByID(ctx context.Context, accountID, serviceID string) (*Service, error)
	GetAccountServices(ctx context.Context, accountID string) ([]*Service, error)
	GetServiceIDByTargetID(ctx context.Context, accountID string, resourceID string) (string, error)
	CreateServiceFromPeer(ctx context.Context, accountID, peerID string, req *ExposeServiceRequest) (*ExposeServiceResponse, error)
	RenewServiceFromPeer(ctx context.Context, accountID, peerID, domain string) error
	StopServiceFromPeer(ctx context.Context, accountID, peerID, domain string) error
	StartExposeReaper(ctx context.Context)
}

type MockManager

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

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) CreateService

func (m *MockManager) CreateService(ctx context.Context, accountID, userID string, service *Service) (*Service, error)

CreateService mocks base method.

func (*MockManager) CreateServiceFromPeer added in v0.66.0

func (m *MockManager) CreateServiceFromPeer(ctx context.Context, accountID, peerID string, req *ExposeServiceRequest) (*ExposeServiceResponse, error)

CreateServiceFromPeer mocks base method.

func (*MockManager) DeleteAllServices added in v0.66.0

func (m *MockManager) DeleteAllServices(ctx context.Context, accountID, userID string) error

DeleteAllServices mocks base method.

func (*MockManager) DeleteService

func (m *MockManager) DeleteService(ctx context.Context, accountID, userID, serviceID string) error

DeleteService mocks base method.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) GetAccountServices

func (m *MockManager) GetAccountServices(ctx context.Context, accountID string) ([]*Service, error)

GetAccountServices mocks base method.

func (*MockManager) GetAllServices

func (m *MockManager) GetAllServices(ctx context.Context, accountID, userID string) ([]*Service, error)

GetAllServices mocks base method.

func (*MockManager) GetGlobalServices

func (m *MockManager) GetGlobalServices(ctx context.Context) ([]*Service, error)

GetGlobalServices mocks base method.

func (*MockManager) GetService

func (m *MockManager) GetService(ctx context.Context, accountID, userID, serviceID string) (*Service, error)

GetService mocks base method.

func (*MockManager) GetServiceByID

func (m *MockManager) GetServiceByID(ctx context.Context, accountID, serviceID string) (*Service, error)

GetServiceByID mocks base method.

func (*MockManager) GetServiceIDByTargetID

func (m *MockManager) GetServiceIDByTargetID(ctx context.Context, accountID, resourceID string) (string, error)

GetServiceIDByTargetID mocks base method.

func (*MockManager) ReloadAllServicesForAccount

func (m *MockManager) ReloadAllServicesForAccount(ctx context.Context, accountID string) error

ReloadAllServicesForAccount mocks base method.

func (*MockManager) ReloadService

func (m *MockManager) ReloadService(ctx context.Context, accountID, serviceID string) error

ReloadService mocks base method.

func (*MockManager) RenewServiceFromPeer added in v0.66.0

func (m *MockManager) RenewServiceFromPeer(ctx context.Context, accountID, peerID, domain string) error

RenewServiceFromPeer mocks base method.

func (*MockManager) SetCertificateIssuedAt

func (m *MockManager) SetCertificateIssuedAt(ctx context.Context, accountID, serviceID string) error

SetCertificateIssuedAt mocks base method.

func (*MockManager) SetStatus

func (m *MockManager) SetStatus(ctx context.Context, accountID, serviceID string, status ProxyStatus) error

SetStatus mocks base method.

func (*MockManager) StartExposeReaper added in v0.66.0

func (m *MockManager) StartExposeReaper(ctx context.Context)

StartExposeReaper mocks base method.

func (*MockManager) StopServiceFromPeer added in v0.66.0

func (m *MockManager) StopServiceFromPeer(ctx context.Context, accountID, peerID, domain string) error

StopServiceFromPeer mocks base method.

func (*MockManager) UpdateService

func (m *MockManager) UpdateService(ctx context.Context, accountID, userID string, service *Service) (*Service, error)

UpdateService mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) CreateService

func (mr *MockManagerMockRecorder) CreateService(ctx, accountID, userID, service interface{}) *gomock.Call

CreateService indicates an expected call of CreateService.

func (*MockManagerMockRecorder) CreateServiceFromPeer added in v0.66.0

func (mr *MockManagerMockRecorder) CreateServiceFromPeer(ctx, accountID, peerID, req interface{}) *gomock.Call

CreateServiceFromPeer indicates an expected call of CreateServiceFromPeer.

func (*MockManagerMockRecorder) DeleteAllServices added in v0.66.0

func (mr *MockManagerMockRecorder) DeleteAllServices(ctx, accountID, userID interface{}) *gomock.Call

DeleteAllServices indicates an expected call of DeleteAllServices.

func (*MockManagerMockRecorder) DeleteService

func (mr *MockManagerMockRecorder) DeleteService(ctx, accountID, userID, serviceID interface{}) *gomock.Call

DeleteService indicates an expected call of DeleteService.

func (*MockManagerMockRecorder) GetAccountServices

func (mr *MockManagerMockRecorder) GetAccountServices(ctx, accountID interface{}) *gomock.Call

GetAccountServices indicates an expected call of GetAccountServices.

func (*MockManagerMockRecorder) GetAllServices

func (mr *MockManagerMockRecorder) GetAllServices(ctx, accountID, userID interface{}) *gomock.Call

GetAllServices indicates an expected call of GetAllServices.

func (*MockManagerMockRecorder) GetGlobalServices

func (mr *MockManagerMockRecorder) GetGlobalServices(ctx interface{}) *gomock.Call

GetGlobalServices indicates an expected call of GetGlobalServices.

func (*MockManagerMockRecorder) GetService

func (mr *MockManagerMockRecorder) GetService(ctx, accountID, userID, serviceID interface{}) *gomock.Call

GetService indicates an expected call of GetService.

func (*MockManagerMockRecorder) GetServiceByID

func (mr *MockManagerMockRecorder) GetServiceByID(ctx, accountID, serviceID interface{}) *gomock.Call

GetServiceByID indicates an expected call of GetServiceByID.

func (*MockManagerMockRecorder) GetServiceIDByTargetID

func (mr *MockManagerMockRecorder) GetServiceIDByTargetID(ctx, accountID, resourceID interface{}) *gomock.Call

GetServiceIDByTargetID indicates an expected call of GetServiceIDByTargetID.

func (*MockManagerMockRecorder) ReloadAllServicesForAccount

func (mr *MockManagerMockRecorder) ReloadAllServicesForAccount(ctx, accountID interface{}) *gomock.Call

ReloadAllServicesForAccount indicates an expected call of ReloadAllServicesForAccount.

func (*MockManagerMockRecorder) ReloadService

func (mr *MockManagerMockRecorder) ReloadService(ctx, accountID, serviceID interface{}) *gomock.Call

ReloadService indicates an expected call of ReloadService.

func (*MockManagerMockRecorder) RenewServiceFromPeer added in v0.66.0

func (mr *MockManagerMockRecorder) RenewServiceFromPeer(ctx, accountID, peerID, domain interface{}) *gomock.Call

RenewServiceFromPeer indicates an expected call of RenewServiceFromPeer.

func (*MockManagerMockRecorder) SetCertificateIssuedAt

func (mr *MockManagerMockRecorder) SetCertificateIssuedAt(ctx, accountID, serviceID interface{}) *gomock.Call

SetCertificateIssuedAt indicates an expected call of SetCertificateIssuedAt.

func (*MockManagerMockRecorder) SetStatus

func (mr *MockManagerMockRecorder) SetStatus(ctx, accountID, serviceID, status interface{}) *gomock.Call

SetStatus indicates an expected call of SetStatus.

func (*MockManagerMockRecorder) StartExposeReaper added in v0.66.0

func (mr *MockManagerMockRecorder) StartExposeReaper(ctx interface{}) *gomock.Call

StartExposeReaper indicates an expected call of StartExposeReaper.

func (*MockManagerMockRecorder) StopServiceFromPeer added in v0.66.0

func (mr *MockManagerMockRecorder) StopServiceFromPeer(ctx, accountID, peerID, domain interface{}) *gomock.Call

StopServiceFromPeer indicates an expected call of StopServiceFromPeer.

func (*MockManagerMockRecorder) UpdateService

func (mr *MockManagerMockRecorder) UpdateService(ctx, accountID, userID, service interface{}) *gomock.Call

UpdateService indicates an expected call of UpdateService.

type OIDCValidationConfig

type OIDCValidationConfig struct {
	Issuer             string
	Audiences          []string
	KeysLocation       string
	MaxTokenAgeSeconds int64
}

type Operation

type Operation string
const (
	Create Operation = "create"
	Update Operation = "update"
	Delete Operation = "delete"
)

type PINAuthConfig

type PINAuthConfig struct {
	Enabled bool   `json:"enabled"`
	Pin     string `json:"pin"`
}

type PasswordAuthConfig

type PasswordAuthConfig struct {
	Enabled  bool   `json:"enabled"`
	Password string `json:"password"`
}

type ProxyStatus

type ProxyStatus string

type Service

type Service struct {
	ID                string `gorm:"primaryKey"`
	AccountID         string `gorm:"index"`
	Name              string
	Domain            string    `gorm:"index"`
	ProxyCluster      string    `gorm:"index"`
	Targets           []*Target `gorm:"foreignKey:ServiceID;constraint:OnDelete:CASCADE"`
	Enabled           bool
	PassHostHeader    bool
	RewriteRedirects  bool
	Auth              AuthConfig  `gorm:"serializer:json"`
	Meta              ServiceMeta `gorm:"embedded;embeddedPrefix:meta_"`
	SessionPrivateKey string      `gorm:"column:session_private_key"`
	SessionPublicKey  string      `gorm:"column:session_public_key"`
	Source            string      `gorm:"default:'permanent'"`
	SourcePeer        string
}

func NewService

func NewService(accountID, name, domain, proxyCluster string, targets []*Target, enabled bool) *Service

func (*Service) Copy

func (s *Service) Copy() *Service

func (*Service) DecryptSensitiveData

func (s *Service) DecryptSensitiveData(enc *crypt.FieldEncrypt) error

func (*Service) EncryptSensitiveData

func (s *Service) EncryptSensitiveData(enc *crypt.FieldEncrypt) error

func (*Service) EventMeta

func (s *Service) EventMeta() map[string]any

func (*Service) FromAPIRequest

func (s *Service) FromAPIRequest(req *api.ServiceRequest, accountID string)

func (*Service) InitNewRecord

func (s *Service) InitNewRecord()

InitNewRecord generates a new unique ID and resets metadata for a newly created Service record. This overwrites any existing ID and Meta fields and should only be called during initial creation, not for updates.

func (*Service) ToAPIResponse

func (s *Service) ToAPIResponse() *api.Service

func (*Service) ToProtoMapping

func (s *Service) ToProtoMapping(operation Operation, authToken string, oidcConfig OIDCValidationConfig) *proto.ProxyMapping

func (*Service) Validate

func (s *Service) Validate() error

type ServiceMeta

type ServiceMeta struct {
	CreatedAt           time.Time
	CertificateIssuedAt *time.Time
	Status              string
	LastRenewedAt       *time.Time
}

type Target

type Target struct {
	ID         uint    `gorm:"primaryKey" json:"-"`
	AccountID  string  `gorm:"index:idx_target_account;not null" json:"-"`
	ServiceID  string  `gorm:"index:idx_service_targets;not null" json:"-"`
	Path       *string `json:"path,omitempty"`
	Host       string  `json:"host"` // the Host field is only used for subnet targets, otherwise ignored
	Port       int     `gorm:"index:idx_target_port" json:"port"`
	Protocol   string  `gorm:"index:idx_target_protocol" json:"protocol"`
	TargetId   string  `gorm:"index:idx_target_id" json:"target_id"`
	TargetType string  `gorm:"index:idx_target_type" json:"target_type"`
	Enabled    bool    `gorm:"index:idx_target_enabled" json:"enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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