Skip to content

A TypeScript/JavaScript client library for Netgate TNSR API with comprehensive traffic monitoring and network management capabilities.

License

Notifications You must be signed in to change notification settings

emirkabal/tnsr-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TNSR Client

A TypeScript/JavaScript client library for Netgate TNSR (Trusted Network Security Router) API with comprehensive traffic monitoring and network management capabilities.

Features

  • Traffic Statistics: Real-time traffic monitoring for interfaces and system-wide statistics
  • Network Management: Interface configuration, PBR routes, blackhole routes
  • RESTCONF Protocol: Full support for IETF RFC 8040 standard
  • TypeScript Support: Complete type definitions for better development experience
  • Multiple Endpoints: Automatic fallback for different TNSR API endpoints
  • Error Handling: Comprehensive error handling and debugging support

Installation

bun add tnsr-client

Quick Start

import { createTnsrClient } from "tnsr-client";

// Create client
const client = createTnsrClient("192.168.1.1", "admin", "password");

// Get traffic statistics
const stats = await client.getTrafficStatistics();
console.log("Total RX bytes:", stats.totalRxBytes);
console.log("Total TX bytes:", stats.totalTxBytes);

// Get specific interface traffic
const interfaceStats = await client.getInterfaceTrafficStats("eth0");
console.log("Interface RX packets:", interfaceStats.rxPackets);

Documentation

For detailed documentation, please see:

Testing

npm test

Requirements

  • Node.js 16+ or Bun runtime
  • TNSR device with RESTCONF API enabled
  • Network access to TNSR management interface

License

MIT

Contributing

Issues and pull requests are welcome. For major changes, please open an issue first.

Support

This library supports:

  • TNSR firmware versions with RESTCONF API
  • Both CommonJS and ES modules
  • TypeScript and JavaScript projects
  • Multiple authentication methods

About

A TypeScript/JavaScript client library for Netgate TNSR API with comprehensive traffic monitoring and network management capabilities.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published