respond

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: AGPL-3.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// default multicast group used by announced
	MulticastAddressDefault = "ff05:0:0:0:0:0:2:1001"

	// default udp port used by announced
	PortDefault = 1001

	// maximum receivable size
	MaxDataGramSize = 8192
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector for a specificle respond messages

func NewCollector

func NewCollector(db database.Connection, nodes *runtime.Nodes, config *Config) *Collector

NewCollector creates a Collector struct

func (*Collector) Close

func (coll *Collector) Close()

Close Collector

func (*Collector) SendPacket

func (coll *Collector) SendPacket(destination net.IP)

SendPacket sends a UDP request to the given unicast or multicast address on the first UDP socket

func (*Collector) Start

func (coll *Collector) Start(interval time.Duration)

Start Collector

type Config

type Config struct {
	Enable          bool                  `toml:"enable"`
	Synchronize     duration.Duration     `toml:"synchronize"`
	Interfaces      []InterfaceConfig     `toml:"interfaces"`
	Sites           map[string]SiteConfig `toml:"sites"`
	CollectInterval duration.Duration     `toml:"collect_interval"`
	CustomFields    []CustomFieldConfig   `toml:"custom_field"`
}

func (*Config) SitesDomains

func (c *Config) SitesDomains() (result map[string][]string)

type CustomFieldConfig added in v1.2.1

type CustomFieldConfig struct {
	Name string `toml:"name"`
	Path string `toml:"path"`
}

type InterfaceConfig

type InterfaceConfig struct {
	InterfaceName    string `toml:"ifname"`
	IPAddress        string `toml:"ip_address"`
	SendNoRequest    bool   `toml:"send_no_request"`
	MulticastAddress string `toml:"multicast_address"`
	Port             int    `toml:"port"`
}

type Response

type Response struct {
	Address *net.UDPAddr
	Raw     []byte
}

Response of the respond request

func NewRespone added in v1.2.1

func NewRespone(res *data.ResponseData, addr *net.UDPAddr) (*Response, error)

type SiteConfig

type SiteConfig struct {
	Domains []string `toml:"domains"`
}

Jump to

Keyboard shortcuts

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