Class DefaultServer

DefaultServer is the main server class.

It is responsible for handling incoming DNS requests and routing them to the appropriate handler(s).

DefaultServer is extensible and can be configured with custom middlewares, handlers, routers, loggers, networks, and caches.

Implements

Constructors

Properties

multithreaded: boolean
networks: Network<Packet>[] = []
router: Router

Methods

  • HandleQueries is the main route handler. It first connects all middleware functions, and any functions that match the domain name in the request to a chain of handlers.

    It does so by creating a function that calls each middleware with the next middleware set as the current middleware's next function. This allows each middleware to call the next middleware in the chain.

    It then creates a chain of handlers that match the domain name in the request. Finally, it connects the middleware chain to the handler chain by setting the last middleware's next function to the first handler in the handler chain.

    If no handlers match the domain name in the request, the default handler is called.

    Parameters

    Returns void