dial

package
v1.20.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceServiceResolverCell = cell.Module(
	"service-resolver",
	"Service DNS names to ClusterIP translator",

	cell.Provide(newResourceServiceResolver),
)

ResourceServiceResolverCell provides a ServiceResolver instance to map DNS names matching Kubernetes services to the corresponding ClusterIP address using the services resource. Used by the operator.

View Source
var ServiceResolverCell = cell.Module(
	"service-resolver",
	"Service DNS names to ClusterIP translator",

	cell.Provide(newLBServiceResolver),
)

ServiceResolverCell provides a ServiceResolver instance to map DNS names matching Kubernetes services to the corresponding ClusterIP address using the LB frontends table.

Functions

func NewContextDialer

func NewContextDialer(log *slog.Logger, resolvers ...Resolver) dialContextFn

NewContextDialer returns a custom dialer associated with a set of resolvers, that map the provided address/port pair according to the implemented strategy. The dialer eventually calls (&net.Dialer{}).DialContext on the address/port pair returned by the sequential execution of all provided resolvers.

func NewStaticContextDialerWithFallback

func NewStaticContextDialerWithFallback(
	log *slog.Logger, hostAliases map[string][]netip.Addr, fallback dialContextFn,
) dialContextFn

NewStaticContextDialerWithFallback returns a dialer that maps the specified hostname to the provided list of IP addresses if the hostname matches or use the fallback otherwise. If the hostname matched, the dialer will attempt to connect to each IP address with a partial deadline distribution similar to net.Dial.

func ServiceBackendResolverFactory added in v1.18.1

func ServiceBackendResolverFactory(ignoredInitializers ...string) func(db *statedb.DB, fes statedb.Table[*loadbalancer.Frontend]) *ServiceBackendResolver

func ServiceURLToNamespacedName

func ServiceURLToNamespacedName(host string) (types.NamespacedName, error)

Types

type Resolver

type Resolver interface {
	// Resolve maps the provided host and port, according to the implemented strategy
	// (e.g., DNS resolution, service load-balancing, ...). The original host and port
	// must be returned in case no mapping can be found.
	Resolve(ctx context.Context, host, port string) (string, string)
}

type ServiceBackendResolver added in v1.18.1

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

func (*ServiceBackendResolver) Resolve added in v1.18.1

func (sr *ServiceBackendResolver) Resolve(ctx context.Context, host, port string) (string, string)

Jump to

Keyboard shortcuts

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