Documentation
¶
Index ¶
- type Server
- func (s *Server) AddSandboxMapping(sandboxID, ipAddr, appName, service string)
- func (s *Server) ListenAndServe() error
- func (s *Server) LookupSandboxByIP(ip string) (sandboxID, appName string, ok bool)
- func (s *Server) RefreshSandboxByIP(ip string) (sandboxID, appName string, ok bool)
- func (s *Server) RemoveSandboxMapping(sandboxID string)
- func (s *Server) Shutdown() error
- func (s *Server) Watch(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
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
AddSandboxMapping registers a sandbox's IP address for DNS resolution.
func (*Server) ListenAndServe ¶
ListenAndServe starts the DNS server
func (*Server) LookupSandboxByIP ¶ added in v0.10.0
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
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
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.