176 lines
4.1 KiB
TypeScript
176 lines
4.1 KiB
TypeScript
import * as plugins from '../plugins.js';
|
|
import * as authInterfaces from '../data/auth.js';
|
|
import type { IVpnClient, IVpnServerStatus, IVpnClientTelemetry } from '../data/vpn.js';
|
|
|
|
// ============================================================================
|
|
// VPN Client Management
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Get all registered VPN clients.
|
|
*/
|
|
export interface IReq_GetVpnClients extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_GetVpnClients
|
|
> {
|
|
method: 'getVpnClients';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
};
|
|
response: {
|
|
clients: IVpnClient[];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get VPN server status.
|
|
*/
|
|
export interface IReq_GetVpnStatus extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_GetVpnStatus
|
|
> {
|
|
method: 'getVpnStatus';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
};
|
|
response: {
|
|
status: IVpnServerStatus;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Create a new VPN client. Returns the config bundle (secrets only shown once).
|
|
*/
|
|
export interface IReq_CreateVpnClient extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_CreateVpnClient
|
|
> {
|
|
method: 'createVpnClient';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
serverDefinedClientTags?: string[];
|
|
description?: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
client?: IVpnClient;
|
|
/** WireGuard .conf file content (only returned at creation) */
|
|
wireguardConfig?: string;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Delete a VPN client.
|
|
*/
|
|
export interface IReq_DeleteVpnClient extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_DeleteVpnClient
|
|
> {
|
|
method: 'deleteVpnClient';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Enable a VPN client.
|
|
*/
|
|
export interface IReq_EnableVpnClient extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_EnableVpnClient
|
|
> {
|
|
method: 'enableVpnClient';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Disable a VPN client.
|
|
*/
|
|
export interface IReq_DisableVpnClient extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_DisableVpnClient
|
|
> {
|
|
method: 'disableVpnClient';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Rotate a VPN client's keys. Returns the new config bundle.
|
|
*/
|
|
export interface IReq_RotateVpnClientKey extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_RotateVpnClientKey
|
|
> {
|
|
method: 'rotateVpnClientKey';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
/** WireGuard .conf file content with new keys */
|
|
wireguardConfig?: string;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Export a VPN client config.
|
|
*/
|
|
export interface IReq_ExportVpnClientConfig extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_ExportVpnClientConfig
|
|
> {
|
|
method: 'exportVpnClientConfig';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
format: 'smartvpn' | 'wireguard';
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
config?: string;
|
|
message?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get telemetry for a specific VPN client.
|
|
*/
|
|
export interface IReq_GetVpnClientTelemetry extends plugins.typedrequestInterfaces.implementsTR<
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
IReq_GetVpnClientTelemetry
|
|
> {
|
|
method: 'getVpnClientTelemetry';
|
|
request: {
|
|
identity: authInterfaces.IIdentity;
|
|
clientId: string;
|
|
};
|
|
response: {
|
|
success: boolean;
|
|
telemetry?: IVpnClientTelemetry;
|
|
message?: string;
|
|
};
|
|
}
|