npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dinodns/redis-store

v0.1.15

Published

A Redis/Valkey storage plugin for DinoDNS

Downloads

269

Readme

DinoDNS Redis Store

The RedisStore is a storage plugin for the DinoDNS DNS framework.

It provides a simple API for storing and retrieving DNS records from a Redis database.

Records are stored in Redis using hash sets, with keys consisting of inverted, colon-joined domain names.

That is, the domain example.com would be stored as com:example. Record types are stored as keys under the domain names.

Wildcard queries are supported. For more information, read the get method documentation.

Installation

npm i @dinodns/redis-store

Usage in DinoDNS

Once you have the Redis store set up as desired, you can use it in the plugin chain by calling

server.use(redisStore.handler.bind(redisStore));

Alternatively, if you're creating a DinoDNS server instance, you can simply set it in constructor

new DinoDNS({
    storage: redisStore,
    ...
});

API

Constructor

new RedisStore(client: Redis | RedisOptions);

or

const store = new RedisStore({
  host: 'localhost',
  port: 6379,
  db: 0,
});
  • client: an instance of ioredis client or a RedisOptions object.

get

Retrieves DNS records from the Redis store

await store.get(name: string, rType?: SupportedRecordType, wildcards?: boolean)
  • name: The domain name to query for
  • rType: The record type ('A', 'AAAA', etc.). Supports all record types DinoDNS supports.
  • wildcards: Whether to enable wildcard matching. Defaults to true.

Note: enabling wildcard matching may incur a small performance penalty but shouldn't be an issue in practice. Wildcard matching is achieved by iterating up each level of the domain hierarchy, so O(n) successive requests are sent for every label in the domain.

set

Sets DNS records in the Redis store, overwriting anything that is there for the record type.

await store.set(name: string, rType: SupportedRecordType, data: SupportedAnswer | SupportedAnswer[]);
  • name: The domain name to set a record for.
  • rType: The record type.
  • data: The dns-packet Answer object.

append

Appends DNS records to the existing records in the Redis store.

await store.append(name: string, rType: SupportedRecordType, data: SupportedAnswer);
  • name: The domain name to append records to.
  • rType: The record type.
  • data: The dns-packet Answer object.

delete

Deletes DNS records from the Redis store. If an rType is not provided, the whole matching zone's records will be deleted. If an Answer object is not provided in the data argument, the entire record type will be deleted for that zone. Answers are matched using deep equality.

await store.delete(name: string, rType?: SupportedRecordType, data?: SupportedAnswer);
  • name: The domain name to delete records from.
  • rType: The record type. Optional.
  • data: The specific DNS record to delete. Optional.