Documentation
¶
Overview ¶
Package service is a generated GoMock package.
Index ¶
- Constants
- func GenerateExposeName(prefix string) (string, error)
- type AuthConfig
- type BearerAuthConfig
- type ExposeServiceRequest
- type ExposeServiceResponse
- type Manager
- type Meta
- type MockManager
- func (m *MockManager) CreateService(ctx context.Context, accountID, userID string, service *Service) (*Service, error)
- func (m *MockManager) CreateServiceFromPeer(ctx context.Context, accountID, peerID string, req *ExposeServiceRequest) (*ExposeServiceResponse, error)
- func (m *MockManager) DeleteAllServices(ctx context.Context, accountID, userID string) error
- func (m *MockManager) DeleteService(ctx context.Context, accountID, userID, serviceID string) error
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) GetAccountServices(ctx context.Context, accountID string) ([]*Service, error)
- func (m *MockManager) GetAllServices(ctx context.Context, accountID, userID string) ([]*Service, error)
- func (m *MockManager) GetGlobalServices(ctx context.Context) ([]*Service, error)
- func (m *MockManager) GetService(ctx context.Context, accountID, userID, serviceID string) (*Service, error)
- func (m *MockManager) GetServiceByID(ctx context.Context, accountID, serviceID string) (*Service, error)
- func (m *MockManager) GetServiceIDByTargetID(ctx context.Context, accountID, resourceID string) (string, error)
- func (m *MockManager) ReloadAllServicesForAccount(ctx context.Context, accountID string) error
- func (m *MockManager) ReloadService(ctx context.Context, accountID, serviceID string) error
- func (m *MockManager) RenewServiceFromPeer(ctx context.Context, accountID, peerID, domain string) error
- func (m *MockManager) SetCertificateIssuedAt(ctx context.Context, accountID, serviceID string) error
- func (m *MockManager) SetStatus(ctx context.Context, accountID, serviceID string, status Status) error
- func (m *MockManager) StartExposeReaper(ctx context.Context)
- func (m *MockManager) StopServiceFromPeer(ctx context.Context, accountID, peerID, domain string) error
- func (m *MockManager) UpdateService(ctx context.Context, accountID, userID string, service *Service) (*Service, error)
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) CreateService(ctx, accountID, userID, service interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) CreateServiceFromPeer(ctx, accountID, peerID, req interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) DeleteAllServices(ctx, accountID, userID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) DeleteService(ctx, accountID, userID, serviceID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) GetAccountServices(ctx, accountID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) GetAllServices(ctx, accountID, userID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) GetGlobalServices(ctx interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) GetService(ctx, accountID, userID, serviceID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) GetServiceByID(ctx, accountID, serviceID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) GetServiceIDByTargetID(ctx, accountID, resourceID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) ReloadAllServicesForAccount(ctx, accountID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) ReloadService(ctx, accountID, serviceID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) RenewServiceFromPeer(ctx, accountID, peerID, domain interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) SetCertificateIssuedAt(ctx, accountID, serviceID interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) SetStatus(ctx, accountID, serviceID, status interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) StartExposeReaper(ctx interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) StopServiceFromPeer(ctx, accountID, peerID, domain interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) UpdateService(ctx, accountID, userID, service interface{}) *gomock.Call
- type Operation
- type PINAuthConfig
- type PasswordAuthConfig
- type Service
- func (s *Service) Copy() *Service
- func (s *Service) DecryptSensitiveData(enc *crypt.FieldEncrypt) error
- func (s *Service) EncryptSensitiveData(enc *crypt.FieldEncrypt) error
- func (s *Service) EventMeta() map[string]any
- func (s *Service) FromAPIRequest(req *api.ServiceRequest, accountID string)
- func (s *Service) InitNewRecord()
- func (s *Service) ToAPIResponse() *api.Service
- func (s *Service) ToProtoMapping(operation Operation, authToken string, oidcConfig proxy.OIDCValidationConfig) *proto.ProxyMapping
- func (s *Service) Validate() error
- type Status
- type Target
Constants ¶
const ( StatusPending Status = "pending" StatusActive Status = "active" StatusTunnelNotCreated Status = "tunnel_not_created" StatusCertificatePending Status = "certificate_pending" StatusCertificateFailed Status = "certificate_failed" StatusError Status = "error" TargetTypePeer = "peer" TargetTypeHost = "host" TargetTypeDomain = "domain" TargetTypeSubnet = "subnet" SourcePermanent = "permanent" SourceEphemeral = "ephemeral" )
Variables ¶
This section is empty.
Functions ¶
func GenerateExposeName ¶
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 ExposeServiceRequest ¶
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 ¶
func (r *ExposeServiceRequest) ToService(accountID, peerID, serviceName string) *Service
ToService builds a Service from the expose request.
func (*ExposeServiceRequest) Validate ¶
func (r *ExposeServiceRequest) Validate() error
Validate checks all fields of the expose request.
type ExposeServiceResponse ¶
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 Status) 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 ¶
func (m *MockManager) CreateServiceFromPeer(ctx context.Context, accountID, peerID string, req *ExposeServiceRequest) (*ExposeServiceResponse, error)
CreateServiceFromPeer mocks base method.
func (*MockManager) DeleteAllServices ¶
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 ¶
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 ¶
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 Status) error
SetStatus mocks base method.
func (*MockManager) StartExposeReaper ¶
func (m *MockManager) StartExposeReaper(ctx context.Context)
StartExposeReaper mocks base method.
func (*MockManager) StopServiceFromPeer ¶
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 ¶
func (mr *MockManagerMockRecorder) CreateServiceFromPeer(ctx, accountID, peerID, req interface{}) *gomock.Call
CreateServiceFromPeer indicates an expected call of CreateServiceFromPeer.
func (*MockManagerMockRecorder) DeleteAllServices ¶
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 ¶
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 ¶
func (mr *MockManagerMockRecorder) StartExposeReaper(ctx interface{}) *gomock.Call
StartExposeReaper indicates an expected call of StartExposeReaper.
func (*MockManagerMockRecorder) StopServiceFromPeer ¶
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 PINAuthConfig ¶
type PasswordAuthConfig ¶
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 Meta `gorm:"embedded;embeddedPrefix:meta_"`
SessionPrivateKey string `gorm:"column:session_private_key"`
SessionPublicKey string `gorm:"column:session_public_key"`
Source string `gorm:"default:'permanent';index:idx_service_source_peer"`
SourcePeer string `gorm:"index:idx_service_source_peer"`
}
func NewService ¶
func (*Service) DecryptSensitiveData ¶
func (s *Service) DecryptSensitiveData(enc *crypt.FieldEncrypt) error
func (*Service) EncryptSensitiveData ¶
func (s *Service) EncryptSensitiveData(enc *crypt.FieldEncrypt) error
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 (*Service) ToProtoMapping ¶
func (s *Service) ToProtoMapping(operation Operation, authToken string, oidcConfig proxy.OIDCValidationConfig) *proto.ProxyMapping
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"`
}