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:
96
ts_client/interfaces.ts
Normal file
96
ts_client/interfaces.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* RADIUS Client Interfaces
|
||||
*/
|
||||
|
||||
import type {
|
||||
ERadiusCode,
|
||||
IRadiusPacket,
|
||||
IParsedAttribute,
|
||||
ENasPortType,
|
||||
EServiceType,
|
||||
EAcctStatusType,
|
||||
} from '../ts_shared/index.js';
|
||||
|
||||
// Re-export all shared types for backwards compatibility
|
||||
export * from '../ts_shared/index.js';
|
||||
|
||||
/**
|
||||
* RADIUS Client options
|
||||
*/
|
||||
export interface IRadiusClientOptions {
|
||||
host: string;
|
||||
authPort?: number;
|
||||
acctPort?: number;
|
||||
secret: string;
|
||||
timeout?: number;
|
||||
retries?: number;
|
||||
retryDelay?: number;
|
||||
nasIpAddress?: string;
|
||||
nasIdentifier?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authentication request for the client
|
||||
*/
|
||||
export interface IClientAuthRequest {
|
||||
username: string;
|
||||
password?: string; // For PAP
|
||||
chapPassword?: Buffer; // For CHAP (CHAP Ident + Response)
|
||||
chapChallenge?: Buffer; // For CHAP
|
||||
nasPort?: number;
|
||||
nasPortType?: ENasPortType;
|
||||
serviceType?: EServiceType;
|
||||
calledStationId?: string;
|
||||
callingStationId?: string;
|
||||
state?: Buffer; // For multi-round authentication
|
||||
customAttributes?: Array<{ type: number | string; value: string | number | Buffer }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authentication response from the server
|
||||
*/
|
||||
export interface IClientAuthResponse {
|
||||
code: ERadiusCode;
|
||||
accepted: boolean;
|
||||
rejected: boolean;
|
||||
challenged: boolean;
|
||||
replyMessage?: string;
|
||||
sessionTimeout?: number;
|
||||
idleTimeout?: number;
|
||||
state?: Buffer;
|
||||
class?: Buffer;
|
||||
framedIpAddress?: string;
|
||||
framedIpNetmask?: string;
|
||||
framedRoutes?: string[];
|
||||
attributes: IParsedAttribute[];
|
||||
rawPacket: IRadiusPacket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accounting request for the client
|
||||
*/
|
||||
export interface IClientAccountingRequest {
|
||||
statusType: EAcctStatusType;
|
||||
sessionId: string;
|
||||
username?: string;
|
||||
nasPort?: number;
|
||||
nasPortType?: ENasPortType;
|
||||
sessionTime?: number;
|
||||
inputOctets?: number;
|
||||
outputOctets?: number;
|
||||
inputPackets?: number;
|
||||
outputPackets?: number;
|
||||
terminateCause?: number;
|
||||
calledStationId?: string;
|
||||
callingStationId?: string;
|
||||
customAttributes?: Array<{ type: number | string; value: string | number | Buffer }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accounting response from the server
|
||||
*/
|
||||
export interface IClientAccountingResponse {
|
||||
success: boolean;
|
||||
attributes: IParsedAttribute[];
|
||||
rawPacket: IRadiusPacket;
|
||||
}
|
||||
Reference in New Issue
Block a user