server

package
v0.0.0-...-e4e3841 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveManifest

func ArchiveManifest(a Archiver, manifest Manifest) error

ArchiveManifest uses an `archiver` to archive a `manifest` once.

func ArchiveToNamedDir

func ArchiveToNamedDir(a Archiver, absSrcPath, dstSubRoot string) error

ArchiveToNamedDir uses an `archiver` to archive `absSrcPath` once. The archive preserves the original directory structure, and is saved at `dstSubRoot`.

func ArchiveToTimestampedDirsForever

func ArchiveToTimestampedDirsForever(archiver Archiver, absSrcPath string, interval time.Duration)

ArchiveToTimestampedDirsForever uses an `archiver` to repeatedly archive `absSrcPath` every `interval`. Each archive preserves the original directory structure, and is saved at `${archiver.DstRoot}/$TIMESTAMP/`.

This function never returns.

func SetupAndServe

func SetupAndServe(port int, targetBinary types.TargetBinary, fuzzerConfig types.FuzzerConfig, archiveConfig types.ArchiveConfig, metricsReportInterval time.Duration, workdir string)

SetupAndServe is the main entry-point for the roving server.

Types

type Archiver

type Archiver interface {

	// Lists all filenames in `relDstRoot`
	LsDstFiles(relDstRoot string) ([]string, error)

	// Describes the dst's root path. For display only.
	DescribeDstRoot() string
	// Describes a relative dst path. For display only.
	DescribeDstLoc(relDstPath string) string
	// contains filtered or unexported methods
}

Roving servers use `Archiver`s to regularly copy their output directory to backup storage. This prevents us from losing valuable work if the server goes down.

The Archiver interface allows us to implement archivers that write to different types of storage.

type DiskArchiver

type DiskArchiver struct {
	DstRoot string
}

A basic Archiver that copies the source to another location on local disk. Mostly useful for testing.

func NewDiskArchiver

func NewDiskArchiver(config types.ArchiveConfig) (DiskArchiver, error)

func (DiskArchiver) DescribeDstLoc

func (a DiskArchiver) DescribeDstLoc(dstRelPath string) string

func (DiskArchiver) DescribeDstRoot

func (a DiskArchiver) DescribeDstRoot() string

func (DiskArchiver) LsDstFiles

func (a DiskArchiver) LsDstFiles(dstSubRoot string) ([]string, error)

LsDstFiles returns the names of all files in the given dir. It does not include directory names, and does not walk sub-trees.

type Manifest

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

A Manifest represents an archiver's intention to archive a set of file. It consists of a `srcRoot` and a collection of `ManifestEntry`s. Each `ManifestEntry` is a `src` (relative to the `srcRoot`) and a `dst` (relative to the archiver's `DstRoot` field).

type ManifestEntry

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

type MetricsPoller

type MetricsPoller struct {
	Nodes    *Nodes
	Interval time.Duration
}

MetricsPoller periodically logs metrics about a Nodes struct.

type Nodes

type Nodes struct {
	Stats map[string]types.FuzzerStats
	// contains filtered or unexported fields
}

Nodes is a struct that gets and sets the stats of Roving clients. Should be used alongside a Reaper in order to cull inactive clients.

type NullArchiver

type NullArchiver struct{}

An archiver that conforms to the Archiver interface but does nothing.

func (NullArchiver) DescribeDstLoc

func (a NullArchiver) DescribeDstLoc(relDstPath string) string

func (NullArchiver) DescribeDstRoot

func (a NullArchiver) DescribeDstRoot() string

func (NullArchiver) LsDstFiles

func (a NullArchiver) LsDstFiles(relDstRoot string) ([]string, error)

type Reaper

type Reaper struct {
	Nodes    Nodes
	Interval time.Duration
}

Reaper removes old nodes from a Nodes struct after they have been inactive for > Interval.

type S3Archiver

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

S3Archiver archives files to S3.

func NewS3Archiver

func NewS3Archiver(config types.ArchiveConfig) (S3Archiver, error)

func (S3Archiver) DescribeDstLoc

func (a S3Archiver) DescribeDstLoc(dstRelPath string) string

func (S3Archiver) DescribeDstRoot

func (a S3Archiver) DescribeDstRoot() string

func (S3Archiver) LsDstFiles

func (a S3Archiver) LsDstFiles(relDstRoot string) ([]string, error)

Jump to

Keyboard shortcuts

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