Files
smartradius/ts_client/interfaces.ts

97 lines
2.1 KiB
TypeScript

/**
* 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;
}