mdns

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigEntry

type ConfigEntry struct {
	Name    string   `yaml:"name" json:"name"` // AKA "instance name"
	Service string   `yaml:"service" json:"service"`
	Domain  string   `yaml:"domain" json:"domain"`
	Port    int      `yaml:"port" json:"port"`
	TTL     uint32   `yaml:"ttl" json:"ttl"`
	Text    []string `yaml:"text" json:"text"`
	// Hostname is a string representing the host to lookup
	// This is its DNS name. If left blank, then this subsystem will
	// use os.Hostname()
	Hostname string `yaml:"hostname" json:"hostname"`
	// Ips is a comma separate string of one or more IP address
	// if blank, then then the hostname will be looked up for interface
	// being publish on.
	Ips string `yaml:"ips" json:"ips"`
	// Interfaces should be a comma separate string stating all interfaces
	// to publish the record on. If left empty it will publish on all interfaces
	Interfaces string `yaml:"interfaces" json:"interfaces"`
	// NotInterfaces black lists certain interfaces from being published on, even if
	// Interfaces names them, or is set to empty
	NotInterfaces string `yaml:"not_interfaces" json:"not_interfaces"`
	// NotPersistent if true means the record will not be stored in the maestro
	// config database
	NotPersistent bool `yaml:"not_persistent" json:"not_persistent"`
	// contains filtered or unexported fields
}

ConfigEntry is the config entry for a single published MDNS record

type Manager

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

Manager is a singleton which manage all MDNS publication for maestro

func GetInstance

func GetInstance() *Manager

GetInstance returns and creates if needed the singleton instance of the MDNS manager

func (*Manager) LoadFromConfigFile

func (mgr *Manager) LoadFromConfigFile(entries []*ConfigEntry) (allok bool, errs []error)

LoadFromConfigFile loads up ConfigEntry which were published in the config file. The big difference here is that we mark these as NotPersistent

func (*Manager) PublishEntry

func (mgr *Manager) PublishEntry(entry *ConfigEntry) (err error)

PublishEntry publishes one or multiple mDNS records to the network on the interfaces specifed (or all interfaces) - if NotPersistent is not set publications will be published again on restart of maestro when they are re-read from the database

func (*Manager) RefreshInterfaces

func (mgr *Manager) RefreshInterfaces() (err error)

RefreshInterfaces when called, will walk though all published records, and look and see if the interfaces IP addresses changed. If they did it will use new IP, and republish the record. This only matters for records which don't have a stated IP. Such case is the usual case.

func (*Manager) ShutdownAllPublished

func (mgr *Manager) ShutdownAllPublished() (err error)

ShutdownAllPublished TODO - shutsdown all mdns servers

func (*Manager) StorageClosed

func (mgr *Manager) StorageClosed(instance storage.MaestroDBStorageInterface)

StorageClosed is called when storage is closed implements the storage.StorageUser interface

func (*Manager) StorageInit

func (mgr *Manager) StorageInit(instance storage.MaestroDBStorageInterface)

StorageInit implements the storage.StorageUser interface implements the storage.StorageUser interface

func (*Manager) StorageReady

func (mgr *Manager) StorageReady(instance storage.MaestroDBStorageInterface)

StorageReady is called when the DB is initialized implements the storage.StorageUser interface

Jump to

Keyboard shortcuts

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