dns

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*dns.Server
	// contains filtered or unexported fields
}

func New

func New(addr string, entityClient *entityserver_v1alpha.EntityAccessClient, log *slog.Logger) (*Server, error)

New creates a new DNS forwarding server

func NewTestServer added in v0.10.0

func NewTestServer() *Server

NewTestServer creates a minimal Server for testing without binding to a port.

func (*Server) AddSandboxMapping added in v0.10.0

func (s *Server) AddSandboxMapping(sandboxID, ipAddr, appName, service string)

AddSandboxMapping registers a sandbox's IP address for DNS resolution.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the DNS server

func (*Server) LookupSandboxByIP added in v0.10.0

func (s *Server) LookupSandboxByIP(ip string) (sandboxID, appName string, ok bool)

LookupSandboxByIP returns the sandbox entity ID and app name for a given IP. On a cache miss, falls back to an entity store lookup to handle watcher lag.

func (*Server) RefreshSandboxByIP added in v0.13.0

func (s *Server) RefreshSandboxByIP(ip string) (sandboxID, appName string, ok bool)

RefreshSandboxByIP re-derives an address's owner from the entity store and returns the result, ignoring what is cached. Callers use it when they have evidence the cached answer is wrong — the token server, for instance, when a caller presents a secret the resolved sandbox does not own.

It is deliberately non-destructive: if the store cannot answer, the existing mapping is left in place rather than dropped, so a transient entity-store failure during a request that was already going to be rejected cannot also blank out an address's DNS.

func (*Server) RemoveSandboxMapping added in v0.13.0

func (s *Server) RemoveSandboxMapping(sandboxID string)

RemoveSandboxMapping withdraws a sandbox's claim on its address. It is called by the sandbox controller when a sandbox is torn down, so a local teardown takes effect immediately rather than waiting on the entity watcher.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown gracefully shuts down the server

func (*Server) Watch

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

Watch starts watching sandbox entities and maintains in-memory DNS mappings. It processes the initial snapshot synchronously so DNS is warm before returning, then consumes live changes in the background.

Jump to

Keyboard shortcuts

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