A TypeScript/JavaScript client library for Netgate TNSR (Trusted Network Security Router) API with comprehensive traffic monitoring and network management capabilities.
- 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
bun add tnsr-clientimport { 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);For detailed documentation, please see:
- API Reference - Complete API documentation
- Traffic Statistics - Traffic monitoring guide
- Installation Guide - Setup and configuration
npm test- Node.js 16+ or Bun runtime
- TNSR device with RESTCONF API enabled
- Network access to TNSR management interface
MIT
Issues and pull requests are welcome. For major changes, please open an issue first.
This library supports:
- TNSR firmware versions with RESTCONF API
- Both CommonJS and ES modules
- TypeScript and JavaScript projects
- Multiple authentication methods