dial

package
v1.17.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 14 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 logrus.FieldLogger, resolvers ...Resolver) dialContextFn

NewContextDialer returns a custom dialer associated with a set of resolvers, that map the target hostname into the corresponding IP address (or a possible alias DNS name). The dialer eventually calls (&net.Dialer{}).DialContext with the first successfully translated address, or the original one otherwise.

func ServiceURLToNamespacedName

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

Types

type Resolver

type Resolver interface {
	// Resolve translates the provided hostname into the corresponding IP address, or
	// possibly another alias DNS name. An error is returned if no mapping is found.
	Resolve(ctx context.Context, host string) (string, error)
}

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 string) (string, error)

Jump to

Keyboard shortcuts

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