Skip to content

funish/axis

Repository files navigation

Axis

GitHub Contributor Covenant

Unified network toolkit for IP address manipulation, RDAP operations, DNS management, geolocation queries, and network connectivity detection

Packages

This is a monorepo that contains the following packages:

  • ipdo - Powerful IP address manipulation library
  • rdap - Modern RDAP (Registration Data Access Protocol) client
  • undns - Core DNS management library with unified API
  • geoip0 - Unified geolocation information query library with multi-provider support
  • unping - Unified network connectivity detection library with multi-driver support

Quick Start

Installation

# Clone the repository
git clone https://github.com/funish/axis.git
cd axis

# Install dependencies
pnpm install

Basic Usage

// IP address manipulation with ipdo
import { isValidIP, parseCIDR, ipInRange } from "ipdo";

console.log(isValidIP("192.168.1.1")); // true
const range = parseCIDR("192.168.0.0/24");
console.log(ipInRange("192.168.0.0/24", "192.168.0.1")); // true

// DNS management with undns
import { createDNSManager } from "undns";
import nodeDriver from "undns/drivers/node";

const dns = createDNSManager({
  driver: nodeDriver({
    servers: ["8.8.8.8", "1.1.1.1"],
  }),
});

const records = await dns.getRecords("example.com");
console.log(`Found ${records.length} records`);

// RDAP queries with rdap
import { queryDomain, queryIP, queryASN } from "rdap";

const domainInfo = await queryDomain("example.com");
const ipInfo = await queryIP("8.8.8.8");
const asnInfo = await queryASN("15169");

console.log("Domain:", domainInfo.handle);
console.log("IP Network:", ipInfo.handle);
console.log("ASN:", asnInfo.handle);

// Geolocation queries with geoip0
import { createGeoIPManager } from "geoip0";
import ipsbDriver from "geoip0/drivers/ipsb";

const geoip = createGeoIPManager({
  driver: ipsbDriver(),
});

const location = await geoip.lookup("1.1.1.1");
const currentLocation = await geoip.current();

console.log("Location for 1.1.1.1:", location?.country, location?.city);
console.log(
  "Current IP location:",
  currentLocation?.country,
  currentLocation?.city,
);

// Network connectivity detection with unping
import { createPingManager } from "unping";
import tcpDriver from "unping/drivers/tcp";

const ping = createPingManager({
  driver: tcpDriver({ port: 80 }),
});

const results = await ping.ping("example.com");
console.log(
  `Host is ${results[0].alive ? "reachable" : "unreachable"} (${results[0].time}ms)`,
);

Development

# Development mode
pnpm dev

# Build the project
pnpm build

# Run linting
pnpm lint

# Test the implementation
bun playground/drivers/node.ts
bun playground/geoip0/drivers/ipsb.ts
bun playground/geoip0/server.ts
bun playground/unping/drivers/tcp.ts

Contributing

We welcome contributions! Here's how to get started:

Quick Setup

  1. Fork the repository on GitHub

  2. Clone your fork:

    git clone https://github.com/YOUR_USERNAME/axis.git
    cd axis
  3. Add upstream remote:

    git remote add upstream https://github.com/funish/axis.git
  4. Install dependencies:

    pnpm install
  5. Development mode:

    pnpm dev

Development Workflow

  1. Code: Follow our project standards
  2. Test: pnpm build
  3. Commit: Use conventional commits (feat:, fix:, etc.)
  4. Push: Push to your fork
  5. Submit: Create a Pull Request to upstream repository

Support & Community

License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ by Funish

About

Unified DNS management library for multi-provider DNS operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published