package discovery

import "github.com/appc/spec/discovery"

Package discovery contains an experimental implementation of the Image Discovery section of the appc specification.

Index

Variables

var (
	// Client is the default http.Client used for discovery requests.
	Client            *http.Client
	ClientInsecureTLS *http.Client
)

Functions

func DiscoverACIEndpoints

func DiscoverACIEndpoints(app App, hostHeaders map[string]http.Header, insecure InsecureOption, port uint) (ACIEndpoints, []FailedAttempt, error)

DiscoverACIEndpoints will make HTTPS requests to find the ac-discovery meta tags and optionally will use HTTP if insecure is set. hostHeaders specifies the header to apply depending on the host (e.g. authentication). It will not give up until it has exhausted the path or found an image discovery. If port is 0, the default port will be used.

func DiscoverPublicKeys

func DiscoverPublicKeys(app App, hostHeaders map[string]http.Header, insecure InsecureOption, port uint) (PublicKeys, []FailedAttempt, error)

DiscoverPublicKey will make HTTPS requests to find the ac-public-keys meta tags and optionally will use HTTP if insecure is set. hostHeaders specifies the header to apply depending on the host (e.g. authentication). It will not give up until it has exhausted the path or found an public key. If port is 0, the default port will be used.

func DiscoverWalk

func DiscoverWalk(app App, hostHeaders map[string]http.Header, insecure InsecureOption, port uint, discoverFn DiscoverWalkFunc) (dd *discoveryData, err error)

DiscoverWalk will make HTTPS requests to find discovery meta tags and optionally will use HTTP if insecure is set. hostHeaders specifies the header to apply depending on the host (e.g. authentication). Based on the response of the discoverFn it will continue to recurse up the tree. If port is 0, the default port will be used.

Types

type ACIEndpoint

type ACIEndpoint struct {
	ACI string
	ASC string
}

type ACIEndpoints

type ACIEndpoints []ACIEndpoint

type App

type App struct {
	Name   types.ACIdentifier
	Labels map[types.ACIdentifier]string
}

func NewApp

func NewApp(name string, labels map[types.ACIdentifier]string) (*App, error)

func NewAppFromString

func NewAppFromString(app string) (*App, error)

NewAppFromString takes a command line app parameter and returns a map of labels.

Example app parameters:

example.com/reduce-worker:1.0.0
example.com/reduce-worker,channel=alpha,label=value
example.com/reduce-worker:1.0.0,label=value

As can be seen in above examples - colon, comma and equal sign have special meaning. If any of them has to be a part of a label's value then consider writing your own string to App parser.

func (*App) Copy

func (a *App) Copy() *App

func (*App) String

func (a *App) String() string

String returns the URL-like image name

type DiscoverWalkFunc

type DiscoverWalkFunc func(prefix string, dd *discoveryData, err error) error

DiscoverWalkFunc can stop a DiscoverWalk by returning non-nil error.

type FailedAttempt

type FailedAttempt struct {
	Prefix string
	Error  error
}

FailedAttempt represents a failed discovery attempt. This is for debugging and user feedback.

type InsecureOption

type InsecureOption int
const (
	InsecureNone InsecureOption = 0

	InsecureTLS InsecureOption = 1 << iota
	InsecureHTTP
)

type PublicKeys

type PublicKeys []string

Source Files

discovery.go doc.go http.go parse.go

Version
v0.8.11 (latest)
Published
Sep 19, 2017
Platform
linux/amd64
Imports
15 packages
Last checked
3 weeks ago

Tools for package owners.