@synet/net
Version:
Network abstraction layer for Synet. visit https://syntehtism.ai for more information.
62 lines (61 loc) • 1.67 kB
TypeScript
/**
* Represents the WireGuard configuration entities
* Using readonly for immutability
*/
export interface WireguardKeys {
readonly privateKey: string;
readonly publicKey: string;
}
/**
* Represents the WireGuard interface configuration
*/
export interface InterfaceConfig {
readonly privateKey: string;
readonly address: string;
readonly listenPort?: number;
readonly dns?: string[];
readonly mtu?: number;
readonly table?: string;
readonly preUp?: string;
readonly postUp?: string;
readonly preDown?: string;
readonly postDown?: string;
}
/**
* Represents a peer configuration for WireGuard
*/
export interface PeerConfig {
readonly publicKey: string;
readonly endpoint?: string;
readonly allowedIPs: ReadonlyArray<string>;
readonly persistentKeepalive?: number;
readonly presharedKey?: string;
}
/**
* Represents the status of a WireGuard interface
*/
export interface WireguardInterface {
readonly name: string;
readonly config: InterfaceConfig;
readonly peers: ReadonlyArray<PeerConfig>;
}
/**
* Represents the status of a WireGuard peer
* This includes the public key, handshake status, and transfer statistics
*/
export interface PeerStatus {
readonly publicKey: string;
readonly handshakeStatus: string;
readonly latestHandshake: string;
readonly persistentKeepalive?: number;
readonly transfer: {
readonly rx: string;
readonly tx: string;
};
}
export interface Peer {
readonly publicKey: string;
readonly endpoint: string;
readonly allowedIPs: ReadonlyArray<string>;
readonly persistentKeepalive?: number;
}