mdns_beacon package

Subpackages

Submodules

mdns_beacon.base module

Base mDNS Beacon module.

class mdns_beacon.base.BaseBeacon(ip_version: IPVersion | None = None)[source]

Bases: ABC

mDNS Beacon base class.

Note

Derived beacons must override the _execute method.

ip_version

IP protocol version to use.

run_forever() None[source]

Run beacon forever.

stop() None[source]

Stop Beacon.

Ends zeroconf background threads, and prevent zeroconf instance from servicing further queries.

property zeroconf: Zeroconf

Zeroconf instance.

mdns_beacon.beacon module

Beacon module.

class mdns_beacon.beacon.Beacon(aliases: List[str] | None = None, addresses: List[IPv4Address | IPv6Address] | None = None, port: int = 80, type_: str = 'http', protocol: typing_extensions.Literal[tcp, udp] = 'tcp', ttl: int = 60, weight: int = 0, priority: int = 0, properties: bytes | Dict[str, Any] | None = None, delay_startup: int = 0, *args: Any, **kwargs: Any)[source]

Bases: BaseBeacon

mDNS Beacon.

aliases

Service alias name list.

addresses

IP addresses that the service runs on.

port

Port that the service runs on.

type_

Service type.

protocol

Service protocol.

ttl

TTL used for the announce of the service.

weight

Weight of the service.

priority

Priority of the service.

properties

Dict of properties (or a bytes object with the content of the text field).

delay_startup

Amount of time to wait before trying to start the zeroconf service (in seconds).

\*args

Variable length argument list.

\*\*kwargs

Arbitrary keyword arguments.

property service_type: str

Beacon service type.

property services: List[ServiceInfo]

Services to register on the local network.

stop() None[source]

Stop Beacon.

Unregister all the announced services.

mdns_beacon.listener module

mDNS listener module.

class mdns_beacon.listener.BeaconListener(handlers: ServiceListener | List[Callable[[...], None]], services: List[str] | None = None, timeout: int | float = 5, *args: Any, **kwargs: Any)[source]

Bases: BaseBeacon

mDNS Beacon listener.

handlers

Service listeners or functions to be called when a service is added, updated or removed.

services

Fully qualified service type names list.

timeout

Seconds to wait for any responses.

property default_services: Set[str]

Return default services to listen on local networks.

Module contents

Top-level package for mdns-beacon.