http

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package http implements an attestations collector that reads data from an https endpoint.

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeMoniker      = "http"
	TypeMonikerHTTPS = "https"
)
View Source
var BuildHTTP = func(uriString string) (attestation.Repository, error) {
	if strings.HasPrefix(uriString, "//") {
		uriString = "http:" + uriString
	}
	return New(WithURL(uriString))
}

Implement the factory function

View Source
var BuildHTTPs = func(uriString string) (attestation.Repository, error) {
	if strings.HasPrefix(uriString, "//") {
		uriString = "https:" + uriString
	}
	return New(WithURL(uriString))
}

Functions

func New

func New(funcs ...optFn) (attestation.Fetcher, error)

New creates a new collector. The type of collector returned varies according to the specified URL templates.

func WithReadJSONL

func WithReadJSONL(doit bool) optFn

WithReadJSONL sets the options to assume the data read will be in linear json data.

func WithRetries

func WithRetries(num uint) optFn

WithRetries fetches the number of retires to read

func WithTemplatePredicateType

func WithTemplatePredicateType(templ string) optFn

func WithTemplateSubject

func WithTemplateSubject(templ string) optFn

func WithTemplateSubjectDigest

func WithTemplateSubjectDigest(templ string) optFn

func WithTemplateSubjectName

func WithTemplateSubjectName(templ string) optFn

func WithTemplateSubjectUri

func WithTemplateSubjectUri(templ string) optFn

func WithURL

func WithURL(uriStrings ...string) optFn

WithURL sets the URl to fetch the data

Types

type Collector

type Collector struct {
	Options Options
}

Collector is the general collector that supports fetching from a single URL

func (*Collector) Fetch

type CollectorPredicateType

type CollectorPredicateType struct {
	Options Options
}

CollectorPredicateType implements the attestation.FetcherByPredicateType interface

func (*CollectorPredicateType) Fetch

func (*CollectorPredicateType) FetchByPredicateType

type CollectorPredicateTypeSubject

type CollectorPredicateTypeSubject struct {
	Options Options
}

func (*CollectorPredicateTypeSubject) Fetch

type CollectorSubject

type CollectorSubject struct {
	Options Options
}

CollectorSubject implements the attestation.FetcherBySubject interface

func (*CollectorSubject) Fetch

func (*CollectorSubject) FetchBySubject

type CollectorSubjectAndType

type CollectorSubjectAndType struct {
	Options Options
}

CollectorSubjectAndType implements the attestation.FetcherBySubject and attestation.FetcherByPredicateType interfaces it is not the same as the PredicateTypeSubject interface

func (*CollectorSubjectAndType) Fetch

func (*CollectorSubjectAndType) FetchByPredicateType

func (*CollectorSubjectAndType) FetchBySubject

type Options

type Options struct {
	URLs                         []string
	TemplateSubject              string
	TemplateSubjectDigest        string
	TemplateSubjectName          string
	TemplateSubjectUri           string
	TemplatePredicateType        string
	TemplatePredicateTypeSubject string
	Retries                      uint
	ReadJSONL                    bool
}

Options captures the URLs and templates for the http collector variants. The options control the collector variant that gets returned by New()

func (*Options) CanFetchPredicateType

func (o *Options) CanFetchPredicateType() bool

func (*Options) CanFetchSubject

func (o *Options) CanFetchSubject() bool

func (*Options) CanTemplatePredicateTypeSubject

func (o *Options) CanTemplatePredicateTypeSubject() bool

Jump to

Keyboard shortcuts

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