dns

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package dns answers an actor's DNS from its sandbox's gateway namespace and writes the resolv.conf that points the actor at it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SandboxResolvConf

func SandboxResolvConf(nameserver string, podResolvConf []byte) []byte

SandboxResolvConf replaces the pod's nameservers with nameserver, the address the sandbox's DNS is served on, while preserving the pod's search domains and options for Kubernetes DNS.

func WriteRootfsResolvConf

func WriteRootfsResolvConf(rootfs string, content []byte) error

WriteRootfsResolvConf installs content at /etc/resolv.conf inside rootfs.

os.Root confines path traversal; unlinking prevents writes through existing links.

Types

type Relay added in v0.4.0

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

Relay forwards UDP and TCP DNS unchanged to the worker pod's resolvers. It listens in the sandbox's gateway namespace and dials from the worker's. DNS bypasses the egress tunnel and is not checked against egress policy.

func NewRelay added in v0.4.0

func NewRelay(resolvConfPath string) (*Relay, error)

NewRelay reads nameservers from resolvConfPath and forwards to each on port 53.

func NewRelayForUpstreams added in v0.4.0

func NewRelayForUpstreams(upstreams []string) (*Relay, error)

NewRelayForUpstreams forwards to upstreams, each "host:port", tried in order.

func (*Relay) Serve added in v0.4.0

func (r *Relay) Serve(ctx context.Context, ns netns.Handle) (*Server, error)

Serve serves UDP and TCP DNS in the sandbox's local gateway namespace.

type Server

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

Server is one sandbox's running DNS relay, returned by Relay.Serve.

func (*Server) Stop added in v0.4.0

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

Stop cancels in-flight queries and connections, closes the sockets, and waits for the serving goroutines to exit or ctx to expire.

Jump to

Keyboard shortcuts

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