localapi

package
v0.0.0-...-9d29f1b Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: BSD-3-Clause Imports: 51 Imported by: 0

Documentation

Overview

Package localapi contains the HTTP server handlers for tailscaled's API server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InUseOtherUserIPNStream

func InUseOtherUserIPNStream(w http.ResponseWriter, r *http.Request, err error) (handled bool)

InUseOtherUserIPNStream reports whether r is a request for the watch-ipn-bus handler. If so, it writes an ipn.Notify InUseOtherUser message to the user and returns true. Otherwise it returns false, in which case it doesn't write to w.

Unlike the regular watch-ipn-bus handler, this one doesn't block. The caller (in ipnserver.Server) provides the blocking until the connection is no longer in use.

Types

type Handler

type Handler struct {
	// RequiredPassword, if non-empty, forces all HTTP
	// requests to have HTTP basic auth with this password.
	// It's used by the sandboxed macOS sameuserproof GUI auth mechanism.
	RequiredPassword string

	// PermitRead is whether read-only HTTP handlers are allowed.
	PermitRead bool

	// PermitWrite is whether mutating HTTP handlers are allowed.
	// If PermitWrite is true, everything is allowed.
	// It effectively means that the user is root or the admin
	// (operator user).
	PermitWrite bool

	// PermitCert is whether the client is additionally granted
	// cert fetching access.
	PermitCert bool
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(b *ipnlocal.LocalBackend, logf logger.Logf, netMon *netmon.Monitor, logID logid.PublicID) *Handler

NewHandler creates a new LocalAPI HTTP handler. All parameters except netMon are required (if non-nil it's used to do faster interface lookups).

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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