zeroconfservice

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseInstanceAndService

func ParseInstanceAndService(serviceAddr string) (string, string, error)

ParseInstanceAndService parses one string, which describes a service and split it up into instance name and service name

func ServiceObserver

func ServiceObserver(serviceNamePattern string, serviceAdded func(ServiceInfo) error, serviceRemoved func(ServiceInfo) error) error

ServiceObserver watches for added or removed services whose serviceTypes are matching the serviceNamePattern serviceNamePattern is compared as a glob pattern, i.e. if you want to observe service types beginning with "_io4edge", specify "_io4edge.*"; if you want to observe all services, specify "*".

serviceObserver runs in a loop until one of the callbacks returns an error. serviceAdded and serviceRemoved are called when an instance of an observed service type is added or removed.

Types

type FuncInfoDefault

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

FuncInfoDefault provides the default FunctionInfo implementation

func NewFuncInfoDefault

func NewFuncInfoDefault(address string) *FuncInfoDefault

NewFuncInfoDefault creates a new FuncInfoDefault object with no aux port

func NewFuncInfoDefaultWithAuxPort

func NewFuncInfoDefaultWithAuxPort(address string, auxPort int, auxProtocol string, auxSchemaID string) *FuncInfoDefault

NewFuncInfoDefaultWithAuxPort creates a new FuncInfoDefault object with an aux port

func (*FuncInfoDefault) AuxPort

func (f *FuncInfoDefault) AuxPort() (string, int, error)

AuxPort gives the caller the auxport value of the service protocol and port

func (*FuncInfoDefault) AuxSchemaID

func (f *FuncInfoDefault) AuxSchemaID() (string, error)

AuxSchemaID gives the caller the auxschema value of the service

func (*FuncInfoDefault) FuncClass

func (f *FuncInfoDefault) FuncClass() (string, error)

FuncClass gives the caller the funcclass value of the service

func (*FuncInfoDefault) NetAddress

func (f *FuncInfoDefault) NetAddress() (string, int, error)

NetAddress gives the caller the ip address and port of the service

func (*FuncInfoDefault) Security

func (f *FuncInfoDefault) Security() (string, error)

Security gives the caller the security value of the service

type ServiceInfo

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

ServiceInfo stores the avahi service struct of a service to make information about the service available through getter functions

func GetServiceInfo

func GetServiceInfo(instanceName string, serviceName string, timeout time.Duration) (*ServiceInfo, error)

GetServiceInfo creates a new avahi server if necessary and starts a new service observer instance if no one is already running for the given mdns service name. If a service with the correct service address (consisting of <instance_name>.<service_name>.<protocol>) is found within the specified timeout, a service info object is returned. The instanceName should contain the instance name of the service address The serviceName should contain the service name of the service address together with the protocol The timeout specifies the time to wait for the service to show up

func (*ServiceInfo) AuxPort

func (svcInf *ServiceInfo) AuxPort() (string, int, error)

AuxPort gives the caller the auxport value of the service protocol and port

func (*ServiceInfo) AuxSchemaID

func (svcInf *ServiceInfo) AuxSchemaID() (string, error)

AuxSchemaID gives the caller the auxschema value of the service

func (*ServiceInfo) FuncClass

func (svcInf *ServiceInfo) FuncClass() (string, error)

FuncClass gives the caller the funcclass value of the service

func (*ServiceInfo) GetIPAddressPort

func (svcInf *ServiceInfo) GetIPAddressPort() string

GetIPAddressPort gets the ip address and port from the given service info object. It passes the caller the ip address and the port separated by ":" together in a string.

func (*ServiceInfo) GetInstanceName

func (svcInf *ServiceInfo) GetInstanceName() string

GetInstanceName gets the instance name of the given service info object.

func (*ServiceInfo) GetServiceType

func (svcInf *ServiceInfo) GetServiceType() string

GetServiceType gets the service type of the given service info object

func (*ServiceInfo) NetAddress

func (svcInf *ServiceInfo) NetAddress() (string, int, error)

NetAddress gives the caller the ip address and port of the service

func (*ServiceInfo) Security

func (svcInf *ServiceInfo) Security() (string, error)

Security gives the caller the security value of the service

Jump to

Keyboard shortcuts

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