Added support to auto discovery with SRV DNS registry (#60)

* Added support to auto discovery witih SRV

The yaml configuration has been modified to suport srv parameters.
Now the name is taken form the router identity to allow dynamic
discovery of devices based on SRV registry.

* Corrected format

* feat(collector): Added support to use custom DNS

* feat(collector): get default dns server from resolv.conf

* Remove getIdentity on the static config devices
This commit is contained in:
wolmi
2020-02-04 04:03:45 +01:00
committed by GitHub
parent 75b5f8be36
commit d723fdfe38
5 changed files with 121 additions and 5 deletions

View File

@@ -29,13 +29,23 @@ type Config struct {
// Device represents a target device
type Device struct {
Name string `yaml:"name"`
Address string `yaml:"address"`
User string `yaml:"user"`
Password string `yaml:"password"`
Name string `yaml:"name"`
Address string `yaml:"address,omitempty"`
Srv SrvRecord `yaml:"srv,omitempty"`
User string `yaml:"user"`
Password string `yaml:"password"`
Port string `yaml:"port"`
}
type SrvRecord struct {
Record string `yaml:"record"`
Dns DnsServer `yaml:"dns,omitempty"`
}
type DnsServer struct {
Address string `yaml:"address"`
Port int `yaml:"port"`
}
// Load reads YAML from reader and unmashals in Config
func Load(r io.Reader) (*Config, error) {
b, err := ioutil.ReadAll(r)