server

package
v0.0.0-...-9214aa2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package server implements the collection of detection events into a centralized database with an HTTP API.

The difficulty in supporting both full and incremental scan modes is that we do not have a reliable signal for the disappearance of a detection. To maintain flexibility, the data model stores every raw detection entry and synthesizes path-level information from it, and we support an external method to explicitly acknowledge (resolve) entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenDB

func OpenDB(dburi string) (*sql.DB, error)

Types

type Config

type Config struct {
	SiteInfoPath string       `yaml:"site_info_path"`
	NotifyAddr   string       `yaml:"notify_addr"`
	Mail         *mail.Config `yaml:"mail"`
}

Config for a Server instance.

type RawDetection

type RawDetection struct {
	yarascan.Detection

	ID       int64
	Site     string
	Notified bool
	Resolved bool
}

RawDetection is a detection event as stored in the database: a yarascan.Detection with additional site and state information.

type Server

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

Server for the yarascan HTTP API.

func New

func New(database *sql.DB, config *Config) (*Server, error)

New returns a new Server.

func (*Server) Close

func (s *Server) Close()

Close the Server and all associated resources.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns a http.Handler for the server API. All URL paths start with /api/.

Directories

Path Synopsis
ui

Jump to

Keyboard shortcuts

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