metadata

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package metadata contains the container metadata server.

Index

Constants

This section is empty.

Variables

View Source
var DefaultServerAddress = netip.MustParseAddrPort("169.254.169.254:80")

DefaultServerAddress is the default address for the metadata server.

Functions

This section is empty.

Types

type NodeKeyResolver

type NodeKeyResolver interface {
	LookupPrivateKey(ctx context.Context, nodeID types.NodeID) (crypto.PrivateKey, bool)
}

NodeKeyResolver is an interface that can retrieve the private key of a node hosted on this server.

type Options

type Options struct {
	// Address is the address to bind the metadata server to.
	// Defaults to DefaultMetadataAddress.
	Address netip.AddrPort
	// Host is the host node to use for the metadata server.
	Host host.Node
	// Storage is the storage provider to use for the metadata server.
	Storage *provider.Provider
	// KeyResolver is the key resolver to use for the metadata server.
	KeyResolver NodeKeyResolver
}

Options are the options for the container metadata server.

type Server

type Server struct {
	Options
	// contains filtered or unexported fields
}

Server is the container metadata server.

func NewServer

func NewServer(opts Options) *Server

NewServer creates a new container metadata server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the container metadata server. It blocks until the server is shutdown. If addr is empty, the default address of 169.254.169.254:80 is used.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface and serves the container metadata based on the source IP address.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown shuts down the container metadata server.

Jump to

Keyboard shortcuts

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