dns

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package dns implements functionality for when dealing with fly's internal DNS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apps

func Apps(ctx context.Context) ([]string, error)

Apps returns the applications running in the current organization.

func Instances

func Instances(ctx context.Context, appName, region string) ([]net.IP, error)

Instances returns the IPv6 addresses for all of the instances of the named application in the given region.

Should the given region be empty, Instances returns all of the instances of the named application.

func Peer

func Peer(ctx context.Context, name string) (net.IP, error)

Peer returns the IPv6 address of the named wireguard peer.

func Peers

func Peers(ctx context.Context) ([]string, error)

Peers returns the names of all wireguard peers.

func PrivateIP

func PrivateIP(ctx context.Context) (net.IP, error)

PrivateIP returns the IPv6 address of the local instance.

func Regions

func Regions(ctx context.Context, appName string) ([]string, error)

Regions returns the regions the named application is deployed to.

Types

type DNS

type DNS interface {
	// Regions returns the regions the named application is deployed to.
	Regions(ctx context.Context, appName string) ([]string, error)

	// Instances returns the IPv6 addresses for the instances of the
	// named application in the given region.
	//
	// Should the given region be empty, Instances returns all of the instances
	// of the named application.
	Instances(ctx context.Context, appName, region string) ([]net.IP, error)

	// Apps returns the applications running in the current organization.
	Apps(ctx context.Context) ([]string, error)

	// Peers returns the names of all wireguard peers.
	Peers(ctx context.Context) ([]string, error)

	// Peer returns the IPv6 address of the named wireguard peer.
	Peer(ctx context.Context, name string) (net.IP, error)

	// PrivateIP returns the IPv6 address of the local instance.
	PrivateIP(ctx context.Context) (net.IP, error)
}

DNS wraps the functionality the .internal addresses of fly provide.

func New

func New(r Resolver) DNS

New returns an instance of DNS that uses the given Resolver.

type Resolver

type Resolver interface {
	// LookupTXT returns the DNS TXT records for the given domain name.
	LookupTXT(ctx context.Context, name string) ([]string, error)

	// LookupIP looks up host for the given network. It returns a slice of that
	// host's IP addresses of the type specified by network. network must be one
	// of "ip", "ip4" or "ip6".
	LookupIP(ctx context.Context, network, host string) ([]net.IP, error)
}

Resolver wraps the functionality that instances of DNS rely on.

All instances of net.Resolver implement Resolver.

Jump to

Keyboard shortcuts

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