api

package
v0.0.0-pre.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIEndpoint

type APIEndpoint struct {
	Path   string // Path pattern for this endpoint.
	Get    APIEndpointAction
	Head   APIEndpointAction
	Put    APIEndpointAction
	Post   APIEndpointAction
	Delete APIEndpointAction
	Patch  APIEndpointAction
}

APIEndpoint represents a URL in our API.

type APIEndpointAction

type APIEndpointAction struct {
	Handler        func(d *Daemon, r *http.Request) response.Response
	AccessHandler  func(d *Daemon, r *http.Request) response.Response
	AllowUntrusted bool
}

APIEndpointAction represents an action on an API endpoint.

type Daemon

type Daemon struct {
	ShutdownCtx    context.Context    // Canceled when shutdown starts.
	ShutdownCancel context.CancelFunc // Cancels the shutdownCtx to indicate shutdown starting.
	ShutdownDoneCh chan error         // Receives the result of the d.Stop() function and tells the daemon to end.
	// contains filtered or unexported fields
}

func NewDaemon

func NewDaemon(cfg *config.DaemonConfig) *Daemon

func (*Daemon) Authenticate

func (d *Daemon) Authenticate(w http.ResponseWriter, r *http.Request) (bool, string, string, error)

Authenticate validates an incoming http Request It will check over what protocol it came, what type of request it is and will validate the TLS certificate.

This does not perform authorization, only validates authentication. Returns whether trusted or not, the username (or certificate fingerprint) of the trusted client, and the type of client that has been authenticated (unix or tls).

func (*Daemon) ServerCert

func (d *Daemon) ServerCert() *incusTLS.CertInfo

func (*Daemon) Start

func (d *Daemon) Start() error

func (*Daemon) Stop

func (d *Daemon) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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