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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tcpip/dhcp

v0.3.0

Published

DHCP server built on tcpip.js

Readme

@tcpip/dhcp

DHCP server for tcpip.js virtual networks.

Why?

When you connect a VM like v86 to a tcpip network, it needs an IP address before you can communicate with it. You can configure that address manually by pre-baking it into the image or running the ip command after boot, but this gets tedious and doesn't scale well with multiple VMs. DHCP lets the network manage the IP, gateway, and DNS settings instead. It was designed exactly for this use case.

@tcpip/dhcp lets the guest use its normal DHCP client instead. Start a DHCP server on your tcpip stack, connect the guest to a tap or bridge interface, and the guest can request an address dynamically. You can also advertise your own DNS server through DHCP, which is useful when you want VMs to resolve names on your virtual network.

Installation

npm i tcpip @tcpip/dhcp

Usage

import { createDhcp } from '@tcpip/dhcp';
import { createStack } from 'tcpip';

const stack = await createStack();

const tapInterface = await stack.interfaces.createTap({
  ip: '192.168.1.1/24',
});

const dhcp = await createDhcp(stack.udp);
const server = await dhcp.serve({
  leaseRange: {
    start: '192.168.1.100',
    end: '192.168.1.200',
  },
  serverIdentifier: '192.168.1.1',
  netmask: '255.255.255.0',
  router: '192.168.1.1',
  dnsServers: ['192.168.1.1'],
});

Then connect tapInterface to another virtual device. For example, with @tcpip/v86:

import { createV86NetworkStream } from '@tcpip/v86';
import { connectStreams } from '@tcpip/transport';

const vmNic = createV86NetworkStream(emulator);

connectStreams(tapInterface, vmNic);

Note that the guest needs to run a DHCP client for this to work. Many Linux images do this during boot, but if yours doesn't you can run something like:

udhcpc -i eth0

depending on the DHCP client installed. With v86, you can send commands over the serial console using emulator.serial0_send(...).

Options

type DhcpServerOptions = {
  leaseRange: {
    start: string;
    end: string;
  };
  serverIdentifier: string;
  netmask: string;
  router: string;
  leaseDuration?: number;
  dnsServers?: string[];
  hostname?: string;
  domainName?: string;
  searchDomains?: string[];
};
  • leaseRange: IP addresses the server may assign.
  • serverIdentifier: IP address of this DHCP server, usually the stack interface IP.
  • netmask: subnet mask sent to clients.
  • router: default gateway sent to clients.
  • leaseDuration: lease lifetime in seconds. Defaults to 86400.
  • dnsServers: DNS servers sent to clients.
  • hostname, domainName, searchDomains: optional host/domain settings sent to clients.

The returned server keeps in-memory leases:

console.log([...server.leases.values()]);

Behavior

Supported today:

  • DHCP DISCOVER/OFFER
  • DHCP REQUEST/ACK
  • DHCP RELEASE
  • lease renewal via ciaddr
  • short-lived offer reservations to avoid duplicate concurrent offers
  • UDP broadcast over tcpip

If the lease range is exhausted, the server does not send an offer.

Limitations

This is an MVP DHCP server API for virtual networks. It does not currently support:

  • persistent leases
  • static MAC reservations
  • DHCP client mode
  • DHCP DECLINE or INFORM
  • client identifier option matching
  • lease event callbacks

License

MIT