@synet/net
Version:
Network abstraction layer for Synet. visit https://syntehtism.ai for more information.
51 lines (50 loc) • 1.92 kB
TypeScript
import type { Result } from "@synet/patterns";
import type { InterfaceConfig, PeerConfig, WireguardInterface } from "../entities/wireguard";
/**
* Repository interface for WireGuard configuration management
*/
export interface ConfigurationRepository {
/**
* Get stored interface configuration
* @param interfaceName Name of the interface
*/
getInterfaceConfig(interfaceName: string): Promise<Result<InterfaceConfig | null>>;
/**
* Save interface configuration
* @param interfaceName Name of the interface
* @param config Interface configuration to save
*/
saveInterfaceConfig(interfaceName: string, config: InterfaceConfig): Promise<Result<void>>;
/**
* Get all peers for an interface
* @param interfaceName Name of the interface
*/
getPeers(interfaceName: string): Promise<Result<PeerConfig[]>>;
/**
* Add peer to an interface
* @param interfaceName Name of the interface
* @param peer Peer configuration to add
*/
savePeer(interfaceName: string, peer: PeerConfig): Promise<Result<void>>;
/**
* Remove a peer from an interface
* @param interfaceName Name of the interface
* @param publicKey Public key of the peer to remove
*/
removePeer(interfaceName: string, publicKey: string): Promise<Result<void>>;
/**
* Get complete WireGuard interface configuration
* @param interfaceName Name of the interface
*/
getInterface(interfaceName: string): Promise<Result<WireguardInterface | null>>;
/**
* Remove the interface configuration
* @param interfaceName Name of the interface to remove
*/
removeInterfaceConfig(interfaceName: string): Promise<Result<void>>;
/**
* Remove all peers from an interface configuration
* @param interfaceName Name of the interface
*/
removeAllPeers(interfaceName: string): Promise<Result<void>>;
}