dns

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDomainNotFound     = errors.New("DomainNotFound")
	ErrHostedZoneNotFound = errors.New("HostedZoneNotFound")
	ErrDNSRecordNotFound  = errors.New("DNSRecordNotFound")
	ErrInvalidRequest     = errors.New("InvalidRequest")
)

Functions

func FormatManageServiceURL

func FormatManageServiceURL(surl string, tlsEnabled bool) string

FormatManageServiceURL formats the url to like https://firecamp-manageserver.cluster-firecamp.com:27040/

func GenDNSName

func GenDNSName(svcMemberName string, domainName string) string

GenDNSName generates the dns name for the service member

func GenDefaultDomainName

func GenDefaultDomainName(clusterName string) string

GenDefaultDomainName generates the default domain name for the cluster example: cluster-firecamp.com

func GetDefaultManageServiceDNSName

func GetDefaultManageServiceDNSName(cluster string) string

GetDefaultManageServiceDNSName returns the default management service dnsname. example: firecamp-manageserver.cluster-firecamp.com

func GetDefaultManageServiceURL

func GetDefaultManageServiceURL(cluster string, tlsEnabled bool) string

GetDefaultManageServiceURL returns the default management service address. example: https://firecamp-manageserver.cluster-firecamp.com:27040/

func GetDomainNameFromDNSName

func GetDomainNameFromDNSName(dnsname string) (string, error)

GetDomainNameFromDNSName extracts the domain name from the dns name. example: aa1.test.com, return test.com

func GetManageServiceURL

func GetManageServiceURL(dnsname string, tlsEnabled bool) string

GetManageServiceURL returns the manage server url.

func LookupHost

func LookupHost(host string) (addr string, err error)

LookupHost looks up the given host using the local resolver.

func RegisterDNSName

func RegisterDNSName(ctx context.Context, domainName string, dnsName string, serverInfo server.Info, dnsIns DNS) error

RegisterDNSName registers the dns name

Types

type DNS

type DNS interface {
	GetOrCreateHostedZoneIDByName(ctx context.Context, domainName string, vpcID string, vpcRegion string, private bool) (hostedZoneID string, err error)
	GetHostedZoneIDByName(ctx context.Context, domainName string, vpcID string, vpcRegion string, private bool) (hostedZoneID string, err error)
	DeleteHostedZone(ctx context.Context, hostedZoneID string) error

	// update the dnsName to point to hostIP in the hosted zone.
	// dnsName would be like db-0.domainName, hostIP is the IPv4 address.
	UpdateDNSRecord(ctx context.Context, dnsName string, hostIP string, hostedZoneID string) error
	// Wait till dns record is updated to hostIP.
	WaitDNSRecordUpdated(ctx context.Context, dnsName string, hostIP string, hostedZoneID string) (dnsIP string, err error)
	GetDNSRecord(ctx context.Context, dnsName string, hostedZoneID string) (hostIP string, err error)
	DeleteDNSRecord(ctx context.Context, dnsName string, hostIP string, hostedZoneID string) error

	// LookupLocalDNS looks up the given host using the local resolver.
	LookupLocalDNS(ctx context.Context, dnsName string) (dnsIP string, err error)
}

type MockDNS

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

func NewMockDNS

func NewMockDNS() *MockDNS

func (*MockDNS) DeleteDNSRecord

func (m *MockDNS) DeleteDNSRecord(ctx context.Context, dnsName string, hostIP string, hostedZoneID string) error

func (*MockDNS) DeleteHostedZone

func (m *MockDNS) DeleteHostedZone(ctx context.Context, hostedZoneID string) error

func (*MockDNS) GetDNSRecord

func (m *MockDNS) GetDNSRecord(ctx context.Context, dnsName string, hostedZoneID string) (hostIP string, err error)

func (*MockDNS) GetHostedZoneIDByName

func (m *MockDNS) GetHostedZoneIDByName(ctx context.Context, domainName string, vpcID string, vpcRegion string, private bool) (hostedZoneID string, err error)

func (*MockDNS) GetOrCreateHostedZoneIDByName

func (m *MockDNS) GetOrCreateHostedZoneIDByName(ctx context.Context, domainName string, vpcID string, vpcRegion string, private bool) (hostedZoneID string, err error)

func (*MockDNS) LookupLocalDNS

func (m *MockDNS) LookupLocalDNS(ctx context.Context, dnsName string) (dnsIP string, err error)

func (*MockDNS) UpdateDNSRecord

func (m *MockDNS) UpdateDNSRecord(ctx context.Context, dnsName string, hostIP string, hostedZoneID string) error

func (*MockDNS) WaitDNSRecordUpdated

func (m *MockDNS) WaitDNSRecordUpdated(ctx context.Context, dnsName string, hostIP string, hostedZoneID string) (dnsIP string, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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