ip-assignment

1.0.3 • Public • Published



ip-assignment

Cross-platform dependency-free IP assignment module

Report Bug · Request Feature



What's ip-assignment?

ip-assignment is a cross-platform dependency free ip-assignment module. With ip-assignment, you can easily configure network interfaces in your own projects.

Install

$ npm install ip-assignment

Usage

examples/linux.js

const interfaces = require("ip-assignment");

// This interface has a static IP
const eth0 = {
  name: "eth0",
  ip_address: "192.168.1.98",
  subnet_mask: "24",
  gateway: "192.168.1.1",
  dns_server: "8.8.8.8",
  alternate_dns_server: "8.8.4.4",
};

// This interface has a DHCP IP
const wlan0 = {
  name: "wlan0",
};

interfaces.set([eth0, wlan0]);

examples/windows.js

const interfaces = require("ip-assignment");

// This interface has a static IP
const Ethernet = {
  name: "Ethernet",
  ip_address: "192.168.1.99",
  subnet_mask: "255.255.255.0",
  gateway: "192.168.1.1",
  dns_server: "8.8.8.8",
  alternate_dns_server: "8.8.4.4",
};

interfaces.set([Ethernet]);

License

Copyright © 2022 Sanjay Sunil (sanjaysunil@protonmail.com)

Distributed under the MIT License. See LICENSE for more information.

/ip-assignment/

    Package Sidebar

    Install

    npm i ip-assignment

    Weekly Downloads

    2

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    16.6 kB

    Total Files

    12

    Last publish

    Collaborators

    • sanjaysunil