services

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextServiceV2 added in v1.2.2

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

ContextServiceV2 provides business logic for context snapshot management

func NewContextServiceV2 added in v1.2.2

func NewContextServiceV2(contextRepo *repository.ContextRepositoryV2) *ContextServiceV2

NewContextServiceV2 creates a new ContextService

func (*ContextServiceV2) CreateContextSnapshot added in v1.2.2

CreateContextSnapshot creates a new context snapshot

func (*ContextServiceV2) DeleteContextSnapshot added in v1.2.2

func (s *ContextServiceV2) DeleteContextSnapshot(ctx context.Context, id string) error

DeleteContextSnapshot deletes a context snapshot by ID

func (*ContextServiceV2) GetContextSnapshot added in v1.2.2

func (s *ContextServiceV2) GetContextSnapshot(ctx context.Context, id string) (*models.ContextSnapshot, error)

GetContextSnapshot retrieves a context snapshot by ID

func (*ContextServiceV2) ListContextSnapshots added in v1.2.2

ListContextSnapshots lists context snapshots based on criteria

func (*ContextServiceV2) UpdateContextSnapshot added in v1.2.2

UpdateContextSnapshot updates an existing context snapshot

type MemoryServiceV2 added in v1.2.2

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

MemoryServiceV2 provides business logic for memory management

func NewMemoryServiceV2 added in v1.2.2

func NewMemoryServiceV2(memoryRepo *repository.MemoryRepositoryV2) *MemoryServiceV2

NewMemoryServiceV2 creates a new MemoryService

func (*MemoryServiceV2) DeleteMemory added in v1.2.2

func (s *MemoryServiceV2) DeleteMemory(ctx context.Context, id string) error

DeleteMemory deletes a memory entry by ID

func (*MemoryServiceV2) GetMemory added in v1.2.2

func (s *MemoryServiceV2) GetMemory(ctx context.Context, id string) (*models.Memory, error)

GetMemory retrieves a memory entry by ID

func (*MemoryServiceV2) SearchMemories added in v1.2.2

func (s *MemoryServiceV2) SearchMemories(ctx context.Context, req *models.MemorySearchRequest) ([]*models.Memory, int, error)

SearchMemories searches for memories based on criteria

func (*MemoryServiceV2) StoreMemory added in v1.2.2

StoreMemory stores a new memory entry

func (*MemoryServiceV2) UpdateMemory added in v1.2.2

func (s *MemoryServiceV2) UpdateMemory(ctx context.Context, id string, req *models.MemoryUpdateRequest) (*models.Memory, error)

UpdateMemory updates an existing memory entry

type NVDResponse

type NVDResponse struct {
	ResultsPerPage  int    `json:"resultsPerPage"`
	StartIndex      int    `json:"startIndex"`
	TotalResults    int    `json:"totalResults"`
	Format          string `json:"format"`
	Version         string `json:"version"`
	Timestamp       string `json:"timestamp"`
	Vulnerabilities []struct {
		CVE struct {
			ID               string `json:"id"`
			SourceIdentifier string `json:"sourceIdentifier"`
			Published        string `json:"published"`
			LastModified     string `json:"lastModified"`
			VulnStatus       string `json:"vulnStatus"`
			Descriptions     []struct {
				Lang  string `json:"lang"`
				Value string `json:"value"`
			} `json:"descriptions"`
			Metrics struct {
				CVSSMetricV2 []struct {
					Source   string `json:"source"`
					Type     string `json:"type"`
					CVSSData struct {
						Version               string  `json:"version"`
						VectorString          string  `json:"vectorString"`
						BaseScore             float64 `json:"baseScore"`
						AccessVector          string  `json:"accessVector"`
						AccessComplexity      string  `json:"accessComplexity"`
						Authentication        string  `json:"authentication"`
						ConfidentialityImpact string  `json:"confidentialityImpact"`
						IntegrityImpact       string  `json:"integrityImpact"`
						AvailabilityImpact    string  `json:"availabilityImpact"`
					} `json:"cvssData"`
					BaseSeverity        string  `json:"baseSeverity"`
					ExploitabilityScore float64 `json:"exploitabilityScore"`
					ImpactScore         float64 `json:"impactScore"`
				} `json:"cvssMetricV2"`
				CVSSMetricV3 []struct {
					Source   string `json:"source"`
					Type     string `json:"type"`
					CVSSData struct {
						Version               string  `json:"version"`
						VectorString          string  `json:"vectorString"`
						BaseScore             float64 `json:"baseScore"`
						BaseSeverity          string  `json:"baseSeverity"`
						AttackVector          string  `json:"attackVector"`
						AttackComplexity      string  `json:"attackComplexity"`
						PrivilegesRequired    string  `json:"privilegesRequired"`
						UserInteraction       string  `json:"userInteraction"`
						Scope                 string  `json:"scope"`
						ConfidentialityImpact string  `json:"confidentialityImpact"`
						IntegrityImpact       string  `json:"integrityImpact"`
						AvailabilityImpact    string  `json:"availabilityImpact"`
					} `json:"cvssData"`
					ExploitabilityScore float64 `json:"exploitabilityScore"`
					ImpactScore         float64 `json:"impactScore"`
				} `json:"cvssMetricV3"`
			} `json:"metrics"`
			Weaknesses []struct {
				Source      string `json:"source"`
				Type        string `json:"type"`
				Description []struct {
					Lang  string `json:"lang"`
					Value string `json:"value"`
				} `json:"description"`
			} `json:"weaknesses"`
			Configurations []struct {
				Nodes []struct {
					Operator string `json:"operator"`
					Negate   bool   `json:"negate"`
					CPEMatch []struct {
						Vulnerable      bool   `json:"vulnerable"`
						Criteria        string `json:"criteria"`
						MatchCriteriaID string `json:"matchCriteriaId"`
					} `json:"cpeMatch"`
				} `json:"nodes"`
			} `json:"configurations"`
			References []struct {
				URL    string `json:"url"`
				Source string `json:"source"`
			} `json:"references"`
		} `json:"cve"`
	} `json:"vulnerabilities"`
}

NVDResponse represents the response from NVD API

type RelationshipServiceV2 added in v1.2.2

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

RelationshipServiceV2 provides business logic for relationship management

func NewRelationshipServiceV2 added in v1.2.2

func NewRelationshipServiceV2(relationshipRepo *repository.RelationshipRepositoryV2) *RelationshipServiceV2

NewRelationshipServiceV2 creates a new RelationshipService

func (*RelationshipServiceV2) CreateRelationship added in v1.2.2

CreateRelationship creates a new relationship between memories

func (*RelationshipServiceV2) DeleteRelationship added in v1.2.2

func (s *RelationshipServiceV2) DeleteRelationship(ctx context.Context, id string) error

DeleteRelationship deletes a relationship by ID

func (*RelationshipServiceV2) GetRelationship added in v1.2.2

func (s *RelationshipServiceV2) GetRelationship(ctx context.Context, id string) (*models.Relationship, error)

GetRelationship retrieves a relationship by ID

func (*RelationshipServiceV2) ListRelationships added in v1.2.2

ListRelationships lists relationships based on criteria

func (*RelationshipServiceV2) UpdateRelationship added in v1.2.2

UpdateRelationship updates an existing relationship

type SecurityDataDownloader

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

SecurityDataDownloader handles downloading and updating security datasets

func NewSecurityDataDownloader

func NewSecurityDataDownloader(logger *log.Logger) *SecurityDataDownloader

NewSecurityDataDownloader creates a new security data downloader

func (*SecurityDataDownloader) CheckForUpdates

func (s *SecurityDataDownloader) CheckForUpdates(ctx context.Context, dataSource string, lastUpdate time.Time) (bool, *time.Time, error)

CheckForUpdates checks if there are updates available for security datasets

func (*SecurityDataDownloader) DownloadATTACKDataset

func (s *SecurityDataDownloader) DownloadATTACKDataset(ctx context.Context) ([]models.ATTACKTechnique, []models.ATTACKTactic, error)

DownloadATTACKDataset downloads the MITRE ATT&CK dataset

func (*SecurityDataDownloader) DownloadIncrementalNVD

func (s *SecurityDataDownloader) DownloadIncrementalNVD(ctx context.Context, lastUpdate time.Time) ([]models.NVDCVE, error)

DownloadIncrementalNVD downloads only new CVEs since last update

func (*SecurityDataDownloader) DownloadNVDDataset

func (s *SecurityDataDownloader) DownloadNVDDataset(ctx context.Context) ([]models.NVDCVE, error)

DownloadNVDDataset downloads the complete NVD dataset

func (*SecurityDataDownloader) DownloadOWASPDataset

func (s *SecurityDataDownloader) DownloadOWASPDataset(ctx context.Context) ([]models.OWASPProcedure, error)

DownloadOWASPDataset downloads OWASP security testing procedures and guidelines

func (*SecurityDataDownloader) GetDataSize

func (s *SecurityDataDownloader) GetDataSize() map[string]interface{}

GetDataSize estimates the size of security datasets

type SecurityRetrievalService

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

SecurityRetrievalService handles intelligent retrieval and summarization of security data

func NewSecurityRetrievalService

func NewSecurityRetrievalService(securityRepo repository.SecurityRepositoryInterface, logger *log.Logger) *SecurityRetrievalService

NewSecurityRetrievalService creates a new security retrieval service

func (*SecurityRetrievalService) QuerySecurityData

QuerySecurityData performs intelligent querying across security datasets

type SecurityUpdateService

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

SecurityUpdateService handles intelligent updates to security datasets

func NewSecurityUpdateService

func NewSecurityUpdateService(
	downloader *SecurityDataDownloader,
	securityRepo repository.SecurityRepositoryInterface,
	logger *log.Logger,
) *SecurityUpdateService

NewSecurityUpdateService creates a new security update service

func (*SecurityUpdateService) CheckAndUpdate

func (s *SecurityUpdateService) CheckAndUpdate(ctx context.Context, strategy UpdateStrategy) error

CheckAndUpdate checks for updates and performs intelligent update for a specific data source

func (*SecurityUpdateService) CheckAndUpdateAll

func (s *SecurityUpdateService) CheckAndUpdateAll(ctx context.Context) error

CheckAndUpdateAll checks for updates and performs intelligent updates for all data sources

func (*SecurityUpdateService) ForceFullUpdate

func (s *SecurityUpdateService) ForceFullUpdate(ctx context.Context) error

ForceFullUpdate forces a complete update of all data sources

type SessionServiceV2 added in v1.2.2

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

SessionServiceV2 provides business logic for session management

func NewSessionServiceV2 added in v1.2.2

func NewSessionServiceV2(sessionRepo *repository.SessionRepositoryV2) *SessionServiceV2

NewSessionServiceV2 creates a new SessionService

func (*SessionServiceV2) CreateSession added in v1.2.2

CreateSession creates a new session

func (*SessionServiceV2) DeleteSession added in v1.2.2

func (s *SessionServiceV2) DeleteSession(ctx context.Context, id string) error

DeleteSession deletes a session by ID

func (*SessionServiceV2) GetSession added in v1.2.2

func (s *SessionServiceV2) GetSession(ctx context.Context, id string) (*models.Session, error)

GetSession retrieves a session by ID

func (*SessionServiceV2) ListSessions added in v1.2.2

func (s *SessionServiceV2) ListSessions(ctx context.Context, req *models.SessionListRequest) ([]*models.Session, int, error)

ListSessions lists sessions based on criteria

func (*SessionServiceV2) UpdateSession added in v1.2.2

UpdateSession updates an existing session

type TaskServiceV2 added in v1.2.2

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

TaskServiceV2 provides business logic for task progress tracking

func NewTaskServiceV2 added in v1.2.2

func NewTaskServiceV2(taskRepo *repository.TaskRepositoryV2) *TaskServiceV2

NewTaskServiceV2 creates a new TaskService

func (*TaskServiceV2) CreateTaskProgress added in v1.2.2

CreateTaskProgress creates a new task progress entry

func (*TaskServiceV2) DeleteTaskProgress added in v1.2.2

func (s *TaskServiceV2) DeleteTaskProgress(ctx context.Context, id string) error

DeleteTaskProgress deletes a task progress entry by ID

func (*TaskServiceV2) GetTaskProgress added in v1.2.2

func (s *TaskServiceV2) GetTaskProgress(ctx context.Context, id string) (*models.TaskProgress, error)

GetTaskProgress retrieves a task progress entry by ID

func (*TaskServiceV2) ListTaskProgress added in v1.2.2

func (s *TaskServiceV2) ListTaskProgress(ctx context.Context, req *models.TaskProgressListRequest) ([]*models.TaskProgress, int, error)

ListTaskProgress lists task progress entries based on criteria

func (*TaskServiceV2) UpdateTaskProgress added in v1.2.2

func (s *TaskServiceV2) UpdateTaskProgress(ctx context.Context, id string, req *models.TaskProgressUpdateRequest) (*models.TaskProgress, error)

UpdateTaskProgress updates an existing task progress entry

type UpdateStrategy

type UpdateStrategy struct {
	DataSource      string
	CheckInterval   time.Duration
	ForceFullUpdate bool
	MaxAge          time.Duration
}

UpdateStrategy defines how to handle updates for each data source

func GetDefaultUpdateStrategies

func GetDefaultUpdateStrategies() []UpdateStrategy

GetDefaultUpdateStrategies returns default update strategies for all data sources

Jump to

Keyboard shortcuts

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