types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package types defines useful types that are used in database models.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MinVersion is a special package version which is always sorted first
	MinVersion = Version{/* contains filtered or unexported fields */}
	// MaxVersion is a special package version which is always sorted last
	MaxVersion = Version{/* contains filtered or unexported fields */}
)

Priorities lists all known priorities, ordered from lower to higher

Functions

This section is empty.

Types

type Priority

type Priority string

Priority defines a vulnerability priority

const (
	// Unknown is either a security problem that has not been
	// assigned to a priority yet or a priority that our system
	// did not recognize
	Unknown Priority = "Unknown"
	// Negligible is technically a security problem, but is
	// only theoretical in nature, requires a very special
	// situation, has almost no install base, or does no real
	// damage. These tend not to get backport from upstreams,
	// and will likely not be included in security updates unless
	// there is an easy fix and some other issue causes an update.
	Negligible Priority = "Negligible"
	// Low is a security problem, but is hard to
	// exploit due to environment, requires a user-assisted
	// attack, a small install base, or does very little damage.
	// These tend to be included in security updates only when
	// higher priority issues require an update, or if many
	// low priority issues have built up.
	Low Priority = "Low"
	// Medium is a real security problem, and is exploitable
	// for many people. Includes network daemon denial of service
	// attacks, cross-site scripting, and gaining user privileges.
	// Updates should be made soon for this priority of issue.
	Medium Priority = "Medium"
	// High is a real problem, exploitable for many people in a default
	// installation. Includes serious remote denial of services,
	// local root privilege escalations, or data loss.
	High Priority = "High"
	// Critical is a world-burning problem, exploitable for nearly all people
	// in a default installation of Linux. Includes remote root
	// privilege escalations, or massive data loss.
	Critical Priority = "Critical"
	// Defcon1 is a Critical problem which has been manually highlighted by
	// the team. It requires an immediate attention.
	Defcon1 Priority = "Defcon1"
)

func (Priority) Compare

func (p Priority) Compare(p2 Priority) int

Compare compares two priorities

func (Priority) IsValid

func (p Priority) IsValid() bool

IsValid determines if the priority is a valid one

func (*Priority) Scan added in v1.0.0

func (p *Priority) Scan(value interface{}) error

func (*Priority) Value added in v1.0.0

func (p *Priority) Value() (driver.Value, error)

type Version

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

Version represents a package version

func NewVersion

func NewVersion(str string) (Version, error)

NewVersion function parses a string into a Version struct which can be compared

The implementation is based on http://man.he.net/man5/deb-version on https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version

It uses the dpkg-1.17.25's algorithm (lib/parsehelp.c)

func NewVersionUnsafe

func NewVersionUnsafe(str string) Version

NewVersionUnsafe is just a wrapper around NewVersion that ignore potentiel parsing error. Useful for test purposes

func (Version) Compare

func (a Version) Compare(b Version) int

Compare function compares two Debian-like package version

The implementation is based on http://man.he.net/man5/deb-version on https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version

It uses the dpkg-1.17.25's algorithm (lib/version.c)

func (Version) MarshalJSON

func (v Version) MarshalJSON() ([]byte, error)

func (*Version) Scan added in v1.0.0

func (v *Version) Scan(value interface{}) (err error)

func (Version) String

func (v Version) String() (s string)

String returns the string representation of a Version

func (*Version) UnmarshalJSON

func (v *Version) UnmarshalJSON(b []byte) (err error)

func (*Version) Value added in v1.0.0

func (v *Version) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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