detector

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package detector is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.9.0.

It is generated from these files:

rpc/detector/service.proto

Index

Constants

View Source
const LibDetectorPathPrefix = "/twirp/trivy.detector.LibDetector/"

LibDetectorPathPrefix is used for all URL paths on a twirp LibDetector server. Requests are always: POST LibDetectorPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.

View Source
const OSDetectorPathPrefix = "/twirp/trivy.detector.OSDetector/"

OSDetectorPathPrefix is used for all URL paths on a twirp OSDetector server. Requests are always: POST OSDetectorPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.

Variables

View Source
var Severity_name = map[int32]string{
	0: "UNKNOWN",
	1: "LOW",
	2: "MEDIUM",
	3: "HIGH",
	4: "CRITICAL",
}
View Source
var Severity_value = map[string]int32{
	"UNKNOWN":  0,
	"LOW":      1,
	"MEDIUM":   2,
	"HIGH":     3,
	"CRITICAL": 4,
}

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type DetectResponse

type DetectResponse struct {
	Vulnerabilities      []*Vulnerability `protobuf:"bytes,1,rep,name=vulnerabilities,proto3" json:"vulnerabilities,omitempty"`
	Eosl                 bool             `protobuf:"varint,2,opt,name=eosl,proto3" json:"eosl,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*DetectResponse) Descriptor

func (*DetectResponse) Descriptor() ([]byte, []int)

func (*DetectResponse) GetEosl

func (m *DetectResponse) GetEosl() bool

func (*DetectResponse) GetVulnerabilities

func (m *DetectResponse) GetVulnerabilities() []*Vulnerability

func (*DetectResponse) ProtoMessage

func (*DetectResponse) ProtoMessage()

func (*DetectResponse) Reset

func (m *DetectResponse) Reset()

func (*DetectResponse) String

func (m *DetectResponse) String() string

func (*DetectResponse) XXX_DiscardUnknown

func (m *DetectResponse) XXX_DiscardUnknown()

func (*DetectResponse) XXX_Marshal

func (m *DetectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DetectResponse) XXX_Merge

func (m *DetectResponse) XXX_Merge(src proto.Message)

func (*DetectResponse) XXX_Size

func (m *DetectResponse) XXX_Size() int

func (*DetectResponse) XXX_Unmarshal

func (m *DetectResponse) XXX_Unmarshal(b []byte) error

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type LibDetectRequest

type LibDetectRequest struct {
	FilePath             string     `protobuf:"bytes,1,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"`
	Libraries            []*Library `protobuf:"bytes,2,rep,name=libraries,proto3" json:"libraries,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*LibDetectRequest) Descriptor

func (*LibDetectRequest) Descriptor() ([]byte, []int)

func (*LibDetectRequest) GetFilePath

func (m *LibDetectRequest) GetFilePath() string

func (*LibDetectRequest) GetLibraries

func (m *LibDetectRequest) GetLibraries() []*Library

func (*LibDetectRequest) ProtoMessage

func (*LibDetectRequest) ProtoMessage()

func (*LibDetectRequest) Reset

func (m *LibDetectRequest) Reset()

func (*LibDetectRequest) String

func (m *LibDetectRequest) String() string

func (*LibDetectRequest) XXX_DiscardUnknown

func (m *LibDetectRequest) XXX_DiscardUnknown()

func (*LibDetectRequest) XXX_Marshal

func (m *LibDetectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LibDetectRequest) XXX_Merge

func (m *LibDetectRequest) XXX_Merge(src proto.Message)

func (*LibDetectRequest) XXX_Size

func (m *LibDetectRequest) XXX_Size() int

func (*LibDetectRequest) XXX_Unmarshal

func (m *LibDetectRequest) XXX_Unmarshal(b []byte) error

type LibDetector

type LibDetector interface {
	Detect(context.Context, *LibDetectRequest) (*DetectResponse, error)
}

func NewLibDetectorJSONClient

func NewLibDetectorJSONClient(addr string, client HTTPClient) LibDetector

NewLibDetectorJSONClient creates a JSON client that implements the LibDetector interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewLibDetectorProtobufClient

func NewLibDetectorProtobufClient(addr string, client HTTPClient) LibDetector

NewLibDetectorProtobufClient creates a Protobuf client that implements the LibDetector interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type Library

type Library struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version              string   `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Library) Descriptor

func (*Library) Descriptor() ([]byte, []int)

func (*Library) GetName

func (m *Library) GetName() string

func (*Library) GetVersion

func (m *Library) GetVersion() string

func (*Library) ProtoMessage

func (*Library) ProtoMessage()

func (*Library) Reset

func (m *Library) Reset()

func (*Library) String

func (m *Library) String() string

func (*Library) XXX_DiscardUnknown

func (m *Library) XXX_DiscardUnknown()

func (*Library) XXX_Marshal

func (m *Library) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Library) XXX_Merge

func (m *Library) XXX_Merge(src proto.Message)

func (*Library) XXX_Size

func (m *Library) XXX_Size() int

func (*Library) XXX_Unmarshal

func (m *Library) XXX_Unmarshal(b []byte) error

type OSDetectRequest

type OSDetectRequest struct {
	OsFamily             string     `protobuf:"bytes,1,opt,name=os_family,json=osFamily,proto3" json:"os_family,omitempty"`
	OsName               string     `protobuf:"bytes,2,opt,name=os_name,json=osName,proto3" json:"os_name,omitempty"`
	Packages             []*Package `protobuf:"bytes,3,rep,name=packages,proto3" json:"packages,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*OSDetectRequest) Descriptor

func (*OSDetectRequest) Descriptor() ([]byte, []int)

func (*OSDetectRequest) GetOsFamily

func (m *OSDetectRequest) GetOsFamily() string

func (*OSDetectRequest) GetOsName

func (m *OSDetectRequest) GetOsName() string

func (*OSDetectRequest) GetPackages

func (m *OSDetectRequest) GetPackages() []*Package

func (*OSDetectRequest) ProtoMessage

func (*OSDetectRequest) ProtoMessage()

func (*OSDetectRequest) Reset

func (m *OSDetectRequest) Reset()

func (*OSDetectRequest) String

func (m *OSDetectRequest) String() string

func (*OSDetectRequest) XXX_DiscardUnknown

func (m *OSDetectRequest) XXX_DiscardUnknown()

func (*OSDetectRequest) XXX_Marshal

func (m *OSDetectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*OSDetectRequest) XXX_Merge

func (m *OSDetectRequest) XXX_Merge(src proto.Message)

func (*OSDetectRequest) XXX_Size

func (m *OSDetectRequest) XXX_Size() int

func (*OSDetectRequest) XXX_Unmarshal

func (m *OSDetectRequest) XXX_Unmarshal(b []byte) error

type OSDetector

type OSDetector interface {
	Detect(context.Context, *OSDetectRequest) (*DetectResponse, error)
}

func NewOSDetectorJSONClient

func NewOSDetectorJSONClient(addr string, client HTTPClient) OSDetector

NewOSDetectorJSONClient creates a JSON client that implements the OSDetector interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewOSDetectorProtobufClient

func NewOSDetectorProtobufClient(addr string, client HTTPClient) OSDetector

NewOSDetectorProtobufClient creates a Protobuf client that implements the OSDetector interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type Package

type Package struct {
	// binary package
	// e.g. bind-utils
	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Release string `protobuf:"bytes,3,opt,name=release,proto3" json:"release,omitempty"`
	Epoch   int32  `protobuf:"varint,4,opt,name=epoch,proto3" json:"epoch,omitempty"`
	Arch    string `protobuf:"bytes,5,opt,name=arch,proto3" json:"arch,omitempty"`
	// src package containing some binary packages
	// e.g. bind
	SrcName              string   `protobuf:"bytes,6,opt,name=src_name,json=srcName,proto3" json:"src_name,omitempty"`
	SrcVersion           string   `protobuf:"bytes,7,opt,name=src_version,json=srcVersion,proto3" json:"src_version,omitempty"`
	SrcRelease           string   `protobuf:"bytes,8,opt,name=src_release,json=srcRelease,proto3" json:"src_release,omitempty"`
	SrcEpoch             int32    `protobuf:"varint,9,opt,name=src_epoch,json=srcEpoch,proto3" json:"src_epoch,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Package) Descriptor

func (*Package) Descriptor() ([]byte, []int)

func (*Package) GetArch

func (m *Package) GetArch() string

func (*Package) GetEpoch

func (m *Package) GetEpoch() int32

func (*Package) GetName

func (m *Package) GetName() string

func (*Package) GetRelease

func (m *Package) GetRelease() string

func (*Package) GetSrcEpoch

func (m *Package) GetSrcEpoch() int32

func (*Package) GetSrcName

func (m *Package) GetSrcName() string

func (*Package) GetSrcRelease

func (m *Package) GetSrcRelease() string

func (*Package) GetSrcVersion

func (m *Package) GetSrcVersion() string

func (*Package) GetVersion

func (m *Package) GetVersion() string

func (*Package) ProtoMessage

func (*Package) ProtoMessage()

func (*Package) Reset

func (m *Package) Reset()

func (*Package) String

func (m *Package) String() string

func (*Package) XXX_DiscardUnknown

func (m *Package) XXX_DiscardUnknown()

func (*Package) XXX_Marshal

func (m *Package) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Package) XXX_Merge

func (m *Package) XXX_Merge(src proto.Message)

func (*Package) XXX_Size

func (m *Package) XXX_Size() int

func (*Package) XXX_Unmarshal

func (m *Package) XXX_Unmarshal(b []byte) error

type Severity

type Severity int32
const (
	Severity_UNKNOWN  Severity = 0
	Severity_LOW      Severity = 1
	Severity_MEDIUM   Severity = 2
	Severity_HIGH     Severity = 3
	Severity_CRITICAL Severity = 4
)

func (Severity) EnumDescriptor

func (Severity) EnumDescriptor() ([]byte, []int)

func (Severity) String

func (x Severity) String() string

type TwirpServer

type TwirpServer interface {
	http.Handler
	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)
	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string
	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route twirp requests
	// alongside non-twirp requests on one HTTP listener.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewLibDetectorServer

func NewLibDetectorServer(svc LibDetector, hooks *twirp.ServerHooks) TwirpServer

func NewOSDetectorServer

func NewOSDetectorServer(svc OSDetector, hooks *twirp.ServerHooks) TwirpServer

type Vulnerability

type Vulnerability struct {
	VulnerabilityId      string   `protobuf:"bytes,1,opt,name=vulnerability_id,json=vulnerabilityId,proto3" json:"vulnerability_id,omitempty"`
	PkgName              string   `protobuf:"bytes,2,opt,name=pkg_name,json=pkgName,proto3" json:"pkg_name,omitempty"`
	InstalledVersion     string   `protobuf:"bytes,3,opt,name=installed_version,json=installedVersion,proto3" json:"installed_version,omitempty"`
	FixedVersion         string   `protobuf:"bytes,4,opt,name=fixed_version,json=fixedVersion,proto3" json:"fixed_version,omitempty"`
	Title                string   `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`
	Description          string   `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"`
	Severity             Severity `protobuf:"varint,7,opt,name=severity,proto3,enum=trivy.detector.Severity" json:"severity,omitempty"`
	References           []string `protobuf:"bytes,8,rep,name=references,proto3" json:"references,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Vulnerability) Descriptor

func (*Vulnerability) Descriptor() ([]byte, []int)

func (*Vulnerability) GetDescription

func (m *Vulnerability) GetDescription() string

func (*Vulnerability) GetFixedVersion

func (m *Vulnerability) GetFixedVersion() string

func (*Vulnerability) GetInstalledVersion

func (m *Vulnerability) GetInstalledVersion() string

func (*Vulnerability) GetPkgName

func (m *Vulnerability) GetPkgName() string

func (*Vulnerability) GetReferences

func (m *Vulnerability) GetReferences() []string

func (*Vulnerability) GetSeverity

func (m *Vulnerability) GetSeverity() Severity

func (*Vulnerability) GetTitle

func (m *Vulnerability) GetTitle() string

func (*Vulnerability) GetVulnerabilityId

func (m *Vulnerability) GetVulnerabilityId() string

func (*Vulnerability) ProtoMessage

func (*Vulnerability) ProtoMessage()

func (*Vulnerability) Reset

func (m *Vulnerability) Reset()

func (*Vulnerability) String

func (m *Vulnerability) String() string

func (*Vulnerability) XXX_DiscardUnknown

func (m *Vulnerability) XXX_DiscardUnknown()

func (*Vulnerability) XXX_Marshal

func (m *Vulnerability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Vulnerability) XXX_Merge

func (m *Vulnerability) XXX_Merge(src proto.Message)

func (*Vulnerability) XXX_Size

func (m *Vulnerability) XXX_Size() int

func (*Vulnerability) XXX_Unmarshal

func (m *Vulnerability) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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