Class DNSOverUDP

DNSOverUDP is a network interface for handling DNS requests over UDP.

Implements

Constructors

Properties

address: string
handler?: NetworkHandler

The handler is responsible for processing incoming requests and sending outgoing responses.

networkType: SupportedNetworkType = SupportedNetworkType.UDP

The type of network being used

port: number
serializer: UDPSerializer

The serializer is responsible for encoding and decoding packets. This is the piece of logic responsible for communicating directly with the wire format for whatever network protocol is used by the network interface.

server: Socket

Methods

  • Begin listening for incoming requests.

    The listen method should be able to effectively bootstrap the network interface without accepting additional parameters. This is to support polymorphic startups across a variety of network interfaces without needing to know the specifics of each.

    For example, some network interfaces may bind an array of ports, while others may bind to a single port and address. The listen method should be able to simply call without needing to know the specifics of the network interface.

    Parameters

    • Optionalcallback: (() => void)

      The callback to call when the network interface is ready to receive requests

        • (): void
        • Returns void

    Returns Promise<void>

  • Removes the listener from the underlying network interface.

    Parameters

    • event: string

      The event to unsubscribe from

    • listener: (() => void)

      The listener to remove

        • (): void
        • Returns void

    Returns void

  • Passes the listener to the underlying network interface which may be an event emitter.

    Parameters

    • event: string

      The event to subscribe to

    • listener: (() => void)

      The listener to call when the event is emitted

        • (): void
        • Returns void

    Returns void