ipnserver

package
v1.86.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: BSD-3-Clause Imports: 34 Imported by: 17

Documentation

Overview

Package ipnserver runs the LocalAPI HTTP server that communicates with the LocalBackend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextWithActorForTest added in v1.84.0

func NewContextWithActorForTest(ctx context.Context, actor ipnauth.Actor) context.Context

NewContextWithActorForTest returns a new context that carries the identity of the specified actor. It is used in tests only.

Types

type Server added in v1.18.0

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

Server is an IPN backend and its set of 0 or more active localhost TCP or unix socket connections talking to that backend.

func New added in v1.18.0

func New(logf logger.Logf, logID logid.PublicID, netMon *netmon.Monitor) *Server

New returns a new Server.

To start it, use the Server.Run method.

At some point, either before or after Run, the Server's SetLocalBackend method must also be called before Server can do anything useful.

func (*Server) BlockWhileInUseByOtherForTest added in v1.84.0

func (s *Server) BlockWhileInUseByOtherForTest(ctx context.Context, actor ipnauth.Actor) error

BlockWhileInUseByOtherForTest blocks while the actor can't connect to the server because the server is in use by a different actor. It is used in tests only.

func (*Server) BlockWhileInUseForTest added in v1.84.0

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

BlockWhileInUseForTest blocks until the server becomes idle (no active requests), or the specified context is done. It returns the context's error if it is done. It is used in tests only.

func (*Server) Run added in v1.18.0

func (s *Server) Run(ctx context.Context, ln net.Listener) error

Run runs the server, accepting connections from ln forever.

If the context is done, the listener is closed. It is also the base context of all HTTP requests.

If the Server's LocalBackend has already been set, Run starts it. Otherwise, the next call to SetLocalBackend will start it.

func (*Server) ServeHTMLStatus added in v1.18.0

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

ServeHTMLStatus serves an HTML status page at http://localhost:41112/ for Windows and via $DEBUG_LISTENER/debug/ipn when tailscaled's --debug flag is used to run a debug server.

func (*Server) ServeHTTPForTest added in v1.84.0

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

ServeHTTPForTest responds to a single LocalAPI HTTP request. The request's context carries the actor that made the request and can be created with NewContextWithActorForTest. It is used in tests only.

func (*Server) SetLocalBackend added in v1.34.0

func (s *Server) SetLocalBackend(lb *ipnlocal.LocalBackend)

SetLocalBackend sets the server's LocalBackend.

It should only call be called after calling lb.Start.

Jump to

Keyboard shortcuts

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