@push.rocks/smartradius
🔐 Complete RADIUS Server and Client Library for Node.js
Overview
This is the main entry point for the smartradius library. It re-exports all functionality from the server, client, and shared modules, providing a unified API for RADIUS operations.
What Gets Exported
This module combines exports from:
- ts_shared - Protocol definitions, enums, and core interfaces
- ts_server - Server implementation and utilities
- ts_client - Client implementation
Quick Import
// Everything from one import
import {
// Server
RadiusServer,
RadiusPacket,
RadiusAttributes,
RadiusAuthenticator,
// Client
RadiusClient,
// Shared Enums
ERadiusCode,
ERadiusAttributeType,
EAcctStatusType,
EAcctTerminateCause,
// Shared Interfaces
IRadiusPacket,
IParsedAttribute,
// Server Interfaces
IRadiusServerOptions,
IAuthenticationRequest,
IAuthenticationResponse,
// Client Interfaces
IRadiusClientOptions,
IClientAuthRequest,
IClientAuthResponse,
} from '@push.rocks/smartradius';
Sub-modules
For more targeted imports, see the individual module documentation:
| Module | Description |
|---|---|
| ts_shared | Protocol definitions and enums |
| ts_server | Server implementation |
| ts_client | Client implementation |
Usage Example
import { RadiusServer, RadiusClient, ERadiusCode } from '@push.rocks/smartradius';
// Create server
const server = new RadiusServer({
defaultSecret: 'testing123',
authenticationHandler: async (req) => ({
code: req.password === 'secret'
? ERadiusCode.AccessAccept
: ERadiusCode.AccessReject
}),
});
await server.start();
// Create client
const client = new RadiusClient({
host: '127.0.0.1',
secret: 'testing123',
});
await client.connect();
// Authenticate
const result = await client.authenticatePap('user', 'secret');
console.log('Accepted:', result.accepted);
// Cleanup
await client.disconnect();
await server.stop();