Documentation
¶
Index ¶
- Variables
- type AuditService
- func (s *AuditService) CleanupOldLogs(retentionDays int) error
- func (s *AuditService) GetAuditLogs(userID *uuid.UUID, limit, offset int) ([]model.AuditLog, error)
- func (s *AuditService) GetAuditLogsByResource(resource, resourceID string, limit, offset int) ([]model.AuditLog, error)
- func (s *AuditService) LogAction(userID uuid.UUID, action, resource, resourceID string, success bool, ...) error
- func (s *AuditService) LogAnonymousAction(action, resource, resourceID, ipAddress, userAgent string, success bool, ...) error
- type AuthService
- type HTTPClient
- type HTTPSClient
- type NetworkService
- func (s *NetworkService) CreateNetwork(req *model.NetworkRequest) (*model.Network, error)
- func (s *NetworkService) DeleteNetwork(id uint) error
- func (s *NetworkService) GetNetwork(id uint) (*model.Network, error)
- func (s *NetworkService) GetNetworkByName(name string) (*model.Network, error)
- func (s *NetworkService) GetNetworks() ([]model.Network, error)
- func (s *NetworkService) GetProtocolStatus(id uint) (*model.ProtocolStatus, error)
- func (s *NetworkService) GetSupportedProtocols() []model.ProtocolType
- func (s *NetworkService) TestProtocol(req *model.ProtocolTestRequest) (*model.ProtocolTestResponse, error)
- func (s *NetworkService) UpdateNetwork(id uint, req *model.NetworkRequest) (*model.Network, error)
- type PolicyService
- func (s *PolicyService) CheckAccess(userID uuid.UUID, resource, action string) (bool, error)
- func (s *PolicyService) CreatePolicy(policy *model.Policy, userID uuid.UUID) error
- func (s *PolicyService) DeletePolicy(id uuid.UUID, userID uuid.UUID) error
- func (s *PolicyService) GetPoliciesByUserID(userID uuid.UUID) ([]model.Policy, error)
- func (s *PolicyService) GetPolicyByID(id uuid.UUID, userID uuid.UUID) (*model.Policy, error)
- func (s *PolicyService) UpdatePolicy(policy *model.Policy) error
- type ProtocolClient
- type SNMPCredentials
- type SNMPRequest
- type SNMPResponse
- type SNMPService
- type SNMPWalkResponse
- type SecretService
- func (s *SecretService) CreateSecret(secret *model.Secret, userID uuid.UUID) error
- func (s *SecretService) DeleteSecret(id uuid.UUID, userID uuid.UUID) error
- func (s *SecretService) GetSecretByID(id uuid.UUID, userID uuid.UUID) (*model.Secret, error)
- func (s *SecretService) GetSecretsByUserID(userID uuid.UUID) ([]model.Secret, error)
- func (s *SecretService) UpdateSecret(id uuid.UUID, updates *model.UpdateSecretRequest, userID uuid.UUID) (*model.Secret, error)
- type TCPClient
- type TOTPService
- func (s *TOTPService) CreateTOTP(totp *model.TOTP, userID uuid.UUID) error
- func (s *TOTPService) DeleteTOTP(id uuid.UUID, userID uuid.UUID) error
- func (s *TOTPService) GenerateCode(id uuid.UUID, userID uuid.UUID) (*model.TOTPGenerateResponse, error)
- func (s *TOTPService) GetTOTPByID(id uuid.UUID, userID uuid.UUID) (*model.TOTP, error)
- func (s *TOTPService) GetTOTPsByUserID(userID uuid.UUID) ([]model.TOTP, error)
- type UserService
- func (s *UserService) CreateUser(user *model.User) error
- func (s *UserService) DeleteUser(id uuid.UUID) error
- func (s *UserService) GetDB() *gorm.DB
- func (s *UserService) GetUserByEmail(email string) (*model.User, error)
- func (s *UserService) GetUserByID(id uuid.UUID) (*model.User, error)
- func (s *UserService) UpdateUser(user *model.User) error
- func (s *UserService) ValidatePassword(user *model.User, password string) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSecretNotFound = errors.New("secret not found") ErrSecretExpired = errors.New("secret has expired") )
View Source
var ( ErrUserNotFound = errors.New("user not found") ErrInvalidCredentials = errors.New("invalid credentials") )
View Source
var (
ErrPolicyNotFound = fmt.Errorf("policy not found")
)
View Source
var (
ErrTOTPNotFound = errors.New("TOTP not found")
)
Functions ¶
This section is empty.
Types ¶
type AuditService ¶
type AuditService struct {
// contains filtered or unexported fields
}
func NewAuditService ¶
func NewAuditService(db *gorm.DB) *AuditService
func (*AuditService) CleanupOldLogs ¶
func (s *AuditService) CleanupOldLogs(retentionDays int) error
func (*AuditService) GetAuditLogs ¶
func (*AuditService) GetAuditLogsByResource ¶
func (*AuditService) LogAnonymousAction ¶
func (s *AuditService) LogAnonymousAction(action, resource, resourceID, ipAddress, userAgent string, success bool, details string) error
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(userService *UserService, config *config.JWTConfig) *AuthService
func (*AuthService) GetSession ¶
func (s *AuthService) GetSession(userID uuid.UUID) (*model.SessionResponse, error)
func (*AuthService) Login ¶
func (s *AuthService) Login(email, password string) (*model.LoginResponse, error)
func (*AuthService) ValidateToken ¶
func (s *AuthService) ValidateToken(tokenString string) (*uuid.UUID, error)
type HTTPClient ¶
type HTTPClient struct{}
func (*HTTPClient) GetStatus ¶
func (c *HTTPClient) GetStatus(config *model.ProtocolConfig) (*model.ProtocolStatus, error)
func (*HTTPClient) Test ¶
func (c *HTTPClient) Test(config *model.ProtocolConfig) (*model.ProtocolTestResponse, error)
type HTTPSClient ¶
type HTTPSClient struct{}
func (*HTTPSClient) GetStatus ¶
func (c *HTTPSClient) GetStatus(config *model.ProtocolConfig) (*model.ProtocolStatus, error)
func (*HTTPSClient) Test ¶
func (c *HTTPSClient) Test(config *model.ProtocolConfig) (*model.ProtocolTestResponse, error)
type NetworkService ¶
type NetworkService struct {
// contains filtered or unexported fields
}
func NewNetworkService ¶
func NewNetworkService(db *gorm.DB) *NetworkService
func (*NetworkService) CreateNetwork ¶
func (s *NetworkService) CreateNetwork(req *model.NetworkRequest) (*model.Network, error)
func (*NetworkService) DeleteNetwork ¶
func (s *NetworkService) DeleteNetwork(id uint) error
func (*NetworkService) GetNetwork ¶
func (s *NetworkService) GetNetwork(id uint) (*model.Network, error)
func (*NetworkService) GetNetworkByName ¶
func (s *NetworkService) GetNetworkByName(name string) (*model.Network, error)
func (*NetworkService) GetNetworks ¶
func (s *NetworkService) GetNetworks() ([]model.Network, error)
func (*NetworkService) GetProtocolStatus ¶
func (s *NetworkService) GetProtocolStatus(id uint) (*model.ProtocolStatus, error)
func (*NetworkService) GetSupportedProtocols ¶
func (s *NetworkService) GetSupportedProtocols() []model.ProtocolType
func (*NetworkService) TestProtocol ¶
func (s *NetworkService) TestProtocol(req *model.ProtocolTestRequest) (*model.ProtocolTestResponse, error)
func (*NetworkService) UpdateNetwork ¶
func (s *NetworkService) UpdateNetwork(id uint, req *model.NetworkRequest) (*model.Network, error)
type PolicyService ¶
type PolicyService struct {
// contains filtered or unexported fields
}
func NewPolicyService ¶
func NewPolicyService(db *gorm.DB) *PolicyService
func (*PolicyService) CheckAccess ¶
func (*PolicyService) CreatePolicy ¶
func (*PolicyService) DeletePolicy ¶
func (*PolicyService) GetPoliciesByUserID ¶
func (*PolicyService) GetPolicyByID ¶
func (*PolicyService) UpdatePolicy ¶
func (s *PolicyService) UpdatePolicy(policy *model.Policy) error
type ProtocolClient ¶
type ProtocolClient interface {
Test(config *model.ProtocolConfig) (*model.ProtocolTestResponse, error)
GetStatus(config *model.ProtocolConfig) (*model.ProtocolStatus, error)
}
type SNMPCredentials ¶
type SNMPCredentials struct {
Community string `json:"community"`
Version string `json:"version"` // "v1", "v2c", "v3"
Username string `json:"username,omitempty"`
AuthProtocol string `json:"auth_protocol,omitempty"`
AuthPassword string `json:"auth_password,omitempty"`
PrivProtocol string `json:"priv_protocol,omitempty"`
PrivPassword string `json:"priv_password,omitempty"`
SecurityLevel string `json:"security_level,omitempty"`
}
type SNMPRequest ¶
type SNMPRequest struct {
Target string `json:"target"`
Port int `json:"port"`
OIDs []string `json:"oids"`
Credentials SNMPCredentials `json:"credentials"`
}
type SNMPResponse ¶
type SNMPService ¶
type SNMPService struct {
// contains filtered or unexported fields
}
func NewSNMPService ¶
func NewSNMPService() *SNMPService
func (*SNMPService) GetSNMPData ¶
func (s *SNMPService) GetSNMPData(req SNMPRequest) (*SNMPResponse, error)
func (*SNMPService) TestConnection ¶
func (s *SNMPService) TestConnection(req SNMPRequest) error
func (*SNMPService) WalkSNMP ¶
func (s *SNMPService) WalkSNMP(req SNMPRequest) (*SNMPWalkResponse, error)
type SNMPWalkResponse ¶
type SecretService ¶
type SecretService struct {
// contains filtered or unexported fields
}
func NewSecretService ¶
func NewSecretService(db *gorm.DB, encryptionKey string, kdfSalt string, kdfIter int, auditService *AuditService) *SecretService
func (*SecretService) CreateSecret ¶
func (*SecretService) DeleteSecret ¶
func (*SecretService) GetSecretByID ¶
func (*SecretService) GetSecretsByUserID ¶
func (*SecretService) UpdateSecret ¶
func (s *SecretService) UpdateSecret(id uuid.UUID, updates *model.UpdateSecretRequest, userID uuid.UUID) (*model.Secret, error)
type TCPClient ¶
type TCPClient struct{}
func (*TCPClient) GetStatus ¶
func (c *TCPClient) GetStatus(config *model.ProtocolConfig) (*model.ProtocolStatus, error)
func (*TCPClient) Test ¶
func (c *TCPClient) Test(config *model.ProtocolConfig) (*model.ProtocolTestResponse, error)
type TOTPService ¶
type TOTPService struct {
// contains filtered or unexported fields
}
func NewTOTPService ¶
func NewTOTPService(db *gorm.DB, auditService *AuditService) *TOTPService
func (*TOTPService) CreateTOTP ¶
func (*TOTPService) DeleteTOTP ¶
func (*TOTPService) GenerateCode ¶
func (s *TOTPService) GenerateCode(id uuid.UUID, userID uuid.UUID) (*model.TOTPGenerateResponse, error)
func (*TOTPService) GetTOTPByID ¶
func (*TOTPService) GetTOTPsByUserID ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(db *gorm.DB) *UserService
func (*UserService) CreateUser ¶
func (s *UserService) CreateUser(user *model.User) error
func (*UserService) DeleteUser ¶
func (s *UserService) DeleteUser(id uuid.UUID) error
func (*UserService) GetDB ¶
func (s *UserService) GetDB() *gorm.DB
func (*UserService) GetUserByEmail ¶
func (s *UserService) GetUserByEmail(email string) (*model.User, error)
func (*UserService) GetUserByID ¶
func (*UserService) UpdateUser ¶
func (s *UserService) UpdateUser(user *model.User) error
func (*UserService) ValidatePassword ¶
func (s *UserService) ValidatePassword(user *model.User, password string) bool
Click to show internal directories.
Click to hide internal directories.