ds

package
v0.0.0-...-3d5c393 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Default is the default query.
	Default = "dnssd://?sort=tenants&sort=cpu.pcnt"
	// Timeout is the default query timeout.
	Timeout = 1 * time.Second // query-timeout

)

Variables

This section is empty.

Functions

func DefaultInstance

func DefaultInstance() string

func DefaultTxt

func DefaultTxt(txtFlag map[string]string)

func ParseKv

func ParseKv(arg string) map[string]string

Parse DNS-SD key value string into Map w/sensible default for empty keys

func Register

func Register(instanceFlag, domainFlag, serviceFlag, interfaceFlag string, portFlag int, txtFlag map[string]string) error

func Tenant

func Tenant(delta int)

update tenant count by delta

func Unregister

func Unregister()

func UpdateSysInfo

func UpdateSysInfo(txtFlag map[string]string)

func Verbose

func Verbose(f func(string, ...interface{}))

setup Verbose

Types

type LookupResult

type LookupResult struct {
	Entry dnssd.BrowseEntry
	Error error
}

LookupResult holds a dnssd.BrowseEntry struct and an error. TOOD: it should implement the error interface

func Lookup

func Lookup(query Query, n int) ([]*LookupResult, error)

lookup based on query, return resolved host, port, network, and error uri currently supported dnssd://instance._service._network.domain/?reqkey=reqvalue default for domain is local, default type _ncpu._tcp, and instance is wildcard can omit to underspecify, e.g. dnssd:?arch=arm64 to pick any arm64 cpu server

type Query

type Query struct {
	Type     string
	Instance string
	Domain   string
	Text     map[string][]string
}

Simple form dns-sd query

func Parse

func Parse(uri string) (Query, error)

parse DNS-SD URI to dnssd struct we could subtype BrowseEntry or Service, but why?

Jump to

Keyboard shortcuts

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