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:
93
ts/readme.md
Normal file
93
ts/readme.md
Normal 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();
|
||||
```
|
||||
Reference in New Issue
Block a user