Help us shape the future of Go! Take the 2026 Go Developer Survey

dial

package
v1.18.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

	cell.Provide(newServiceResolver),
)

ServiceResolverCell provides a ServiceResolver instance to map DNS names matching Kubernetes services to the corresponding ClusterIP address, backed by a lazy resource.Store, which is only started on first access.

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 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)

type ServiceResolver

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

ServiceResolver maps DNS names matching Kubernetes services to the corresponding ClusterIP address.

func (*ServiceResolver) Resolve

func (sr *ServiceResolver) 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