hashifork

package
v0.0.0-...-cb43b74 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToBindMulticast = errors.New("failed to bind to any multicast udp port")
	ErrFailedToBindUnicast   = errors.New("failed to bind to any unicast udp port")
)

Functions

func Query

func Query(params *QueryParam) error

Query looks up a given service, in a domain, waiting at most for a timeout before finishing the query. The results are streamed to a channel. Sends will not block, so clients should make sure to either read or buffer.

Types

type QueryParam

type QueryParam struct {
	Service             string               // Service to lookup
	Domain              string               // Lookup domain, default "local"
	Timeout             time.Duration        // Lookup timeout, default 1 second
	Interface           *net.Interface       // Multicast interface to use
	Entries             chan<- *ServiceEntry // Entries Channel
	WantUnicastResponse bool                 // Unicast response desired, as per 5.4 in RFC
}

QueryParam is used to customize how a Lookup is performed.

func DefaultParams

func DefaultParams(service string) *QueryParam

DefaultParams is used to return a default set of QueryParam's.

type ServiceEntry

type ServiceEntry struct {
	Host      string    `json:"host,omitempty"`
	Name      string    `json:"name,omitempty"`
	AddrV4    []net.IP  `json:"addv4,omitempty"`
	AddrV6    []net.IP  `json:"addv6,omitempty"`
	Port      int       `json:"port,omitempty"`
	TimeStamp time.Time `json:"timestamp,omitempty"`

	Text    []string `json:"text,omitempty"`
	TTL     uint32   `json:"TTL,omitempty"` //nolint:tagliatelle
	Service string   `json:"service,omitempty"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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