feat(smartradius): Implement full RADIUS server and client with RFC 2865/2866 compliance, including packet handling, authenticators, attributes, secrets manager, client APIs, and comprehensive tests and documentation

This commit is contained in:
2026-02-01 17:40:36 +00:00
parent 5a6a3cf66e
commit be9f49fff9
45 changed files with 11694 additions and 70 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartradius',
version: '1.1.0',
description: 'A RADIUS server and client implementation for Node.js with full RFC 2865/2866 compliance'
}

View File

@@ -1,3 +1,19 @@
import * as plugins from './plugins.js';
// @push.rocks/smartradius
// RADIUS Server and Client Library
// Implements RFC 2865 (Authentication) and RFC 2866 (Accounting)
export let demoExport = 'Hi there! :) This is an exported string';
// Re-export shared protocol definitions
export * from '../ts_shared/index.js';
// Re-export server module
export * from '../ts_server/index.js';
// Re-export client module
export { RadiusClient } from '../ts_client/index.js';
export type {
IRadiusClientOptions,
IClientAuthRequest,
IClientAuthResponse,
IClientAccountingRequest,
IClientAccountingResponse,
} from '../ts_client/index.js';

View File

@@ -1,5 +0,0 @@
import * as plugins from './plugins.js';
export const packageDir = plugins.path.join(
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../'
);

View File

@@ -1,9 +0,0 @@
// native scope
import * as path from 'path';
export { path };
// @push.rocks scope
import * as smartpath from '@push.rocks/smartpath';
export { smartpath };

93
ts/readme.md Normal file
View File

@@ -0,0 +1,93 @@
# @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
```typescript
// 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](../ts_shared/readme.md) | Protocol definitions and enums |
| [ts_server](../ts_server/readme.md) | Server implementation |
| [ts_client](../ts_client/readme.md) | Client implementation |
## Usage Example
```typescript
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();
```

1
ts/tspublish.json Normal file
View File

@@ -0,0 +1 @@
{ "order": 4 }