register

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFile

func LoadFile(filename string, v interface{}) error

LoadFile reads yaml in filename and unmarshal it to v.

Types

type Config

type Config struct {
	Hostname    string     `yaml:"hostname"`
	Address     string     `yaml:"address"`
	Interval    int        `yaml:"interval"`
	Etcd        EtcdConfig `yaml:"etcd"`
	RecordFiles []string   `yaml:"record_files,omitempty"`
	Records     Records    `yaml:"records,omitempty"`
	SRVRecords  string     `yaml:"srv_records,omitempty"`
}

Config represents setting of coredns-register.

func (*Config) CreateScheduler

func (c *Config) CreateScheduler(lg *zap.Logger) (*Scheduler, error)

CreateScheduler creates a scheduler based on the contents of config.

type EtcdConfig

type EtcdConfig struct {
	DiscoverySRV string   `yaml:"discovery-srv,omitempty"`
	Endpoints    []string `yaml:"endpoints,omitempty"`
	Basepath     string   `yaml:"basepath"`
}

EtcdConfig represents connection setting with etcd v2.

type EtcdRegister

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

EtcdRegister manages DNS registration to the etcd backend of CoreDNS.

func (*EtcdRegister) SRVRegister

func (r *EtcdRegister) SRVRegister(record SRVRecord) error

SRVRegister registers SRV record.

func (*EtcdRegister) SRVUnregister

func (r *EtcdRegister) SRVUnregister(record SRVRecord) error

SRVUnregister unregisters SRV record.

type Records

type Records struct {
	SRV []SRVRecord `yaml:"srv"`
}

Records represents a collection of DNS records.

func (*Records) Add

func (r *Records) Add(a *Records)

Add adds Records to Records.

func (*Records) AddSRV added in v0.0.2

func (r *Records) AddSRV(domain, address string, port int)

AddSRV adds SRVRecord to Records.

func (*Records) InitAddress

func (r *Records) InitAddress(a string)

InitAddress sets an initial value for a DNS record whose address is empty.

type Register

type Register interface {
	SRVRegister(record SRVRecord) error
	SRVUnregister(record SRVRecord) error
}

Register registers DNS record.

type SRVRecord

type SRVRecord struct {
	Domain  string `yaml:"domain"`
	Address string `yaml:"address,omitempty"`
	Port    int    `yaml:"port"`
}

SRVRecord represents SRV Record.

func (*SRVRecord) InitAddress

func (r *SRVRecord) InitAddress(a string)

InitAddress sets an initial value for a DNS record whose address is empty.

type Scheduler

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

Scheduler manages periodic DNS record registration.

func (*Scheduler) Start

func (s *Scheduler) Start(signal chan os.Signal)

Start starts periodic execution of DNS registration.

Jump to

Keyboard shortcuts

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