appc

package
v1.66.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Overview

Package appc implements App Connectors. An AppConnector provides DNS domain oriented routing of traffic. An App Connector becomes a DNS server for a peer, authoritative for the set of configured domains. DNS resolution of the target domain triggers dynamic publication of routes to ensure that traffic to the domain is routed through the App Connector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConnector added in v1.54.0

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

AppConnector is an implementation of an AppConnector that performs its function as a subsystem inside of a tailscale node. At the control plane side App Connector routing is configured in terms of domains rather than IP addresses. The AppConnectors responsibility inside tailscaled is to apply the routing and domain configuration as supplied in the map response. DNS requests for configured domains are observed. If the domains resolve to routes not yet served by the AppConnector the local node configuration is updated to advertise the new route.

func NewAppConnector added in v1.54.0

func NewAppConnector(logf logger.Logf, routeAdvertiser RouteAdvertiser, routeInfo *RouteInfo, storeRoutesFunc func(*RouteInfo) error) *AppConnector

NewAppConnector creates a new AppConnector.

func (*AppConnector) ClearRoutes added in v1.66.0

func (e *AppConnector) ClearRoutes() error

ClearRoutes removes all route state from the AppConnector.

func (*AppConnector) DomainRoutes added in v1.54.0

func (e *AppConnector) DomainRoutes() map[string][]netip.Addr

DomainRoutes returns a map of domains to resolved IP addresses.

func (*AppConnector) Domains added in v1.54.0

func (e *AppConnector) Domains() views.Slice[string]

Domains returns the currently configured domain list.

func (*AppConnector) ObserveDNSResponse added in v1.54.0

func (e *AppConnector) ObserveDNSResponse(res []byte)

ObserveDNSResponse is a callback invoked by the DNS resolver when a DNS response is being returned over the PeerAPI. The response is parsed and matched against the configured domains, if matched the routeAdvertiser is advised to advertise the discovered route.

func (*AppConnector) ShouldStoreRoutes added in v1.66.0

func (e *AppConnector) ShouldStoreRoutes() bool

ShouldStoreRoutes returns true if the appconnector was created with the controlknob on and is storing its discovered routes persistently.

func (*AppConnector) UpdateDomains added in v1.54.0

func (e *AppConnector) UpdateDomains(domains []string)

UpdateDomains asynchronously replaces the current set of configured domains with the supplied set of domains. Domains must not contain a trailing dot, and should be lower case. If the domain contains a leading '*' label it matches all subdomains of a domain.

func (*AppConnector) UpdateDomainsAndRoutes added in v1.58.1

func (e *AppConnector) UpdateDomainsAndRoutes(domains []string, routes []netip.Prefix)

UpdateDomainsAndRoutes starts an asynchronous update of the configuration given the new domains and routes.

func (*AppConnector) Wait added in v1.58.1

func (e *AppConnector) Wait(ctx context.Context)

Wait waits for the currently scheduled asynchronous configuration changes to complete.

type RouteAdvertiser added in v1.54.0

type RouteAdvertiser interface {
	// AdvertiseRoute adds one or more route advertisements skipping any that
	// are already advertised.
	AdvertiseRoute(...netip.Prefix) error

	// UnadvertiseRoute removes any matching route advertisements.
	UnadvertiseRoute(...netip.Prefix) error
}

RouteAdvertiser is an interface that allows the AppConnector to advertise newly discovered routes that need to be served through the AppConnector.

type RouteInfo added in v1.66.0

type RouteInfo struct {
	// Control is the routes from the 'routes' section of an app connector acl.
	Control []netip.Prefix `json:",omitempty"`
	// Domains are the routes discovered by observing DNS lookups for configured domains.
	Domains map[string][]netip.Addr `json:",omitempty"`
	// Wildcards are the configured DNS lookup domains to observe. When a DNS query matches Wildcards,
	// its result is added to Domains.
	Wildcards []string `json:",omitempty"`
}

RouteInfo is a data structure used to persist the in memory state of an AppConnector so that we can know, even after a restart, which routes came from ACLs and which were learned from domains.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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