From 11a3f786cb8aac486005dd6a35c32b16d1671cf6 Mon Sep 17 00:00:00 2001 From: m1m1sha <18262227804@163.com> Date: Sun, 5 May 2024 23:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E6=8B=86=E5=88=86type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easytier-gui/src/types/network.ts | 72 +++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 easytier-gui/src/types/network.ts diff --git a/easytier-gui/src/types/network.ts b/easytier-gui/src/types/network.ts new file mode 100644 index 0000000..286bb48 --- /dev/null +++ b/easytier-gui/src/types/network.ts @@ -0,0 +1,72 @@ +import { v4 as uuidv4 } from 'uuid'; + +export enum NetworkingMethod { + PublicServer = "PublicServer", + Manual = "Manual", + Standalone = "Standalone", +} + +export interface NetworkConfig { + instance_id: string, + + virtual_ipv4: string + network_name: string + network_secret: string + + networking_method: NetworkingMethod, + + public_server_url: string, + peer_urls: Array, + + proxy_cidrs: Array, + + enable_vpn_portal: boolean, + vpn_portal_listne_port: number, + vpn_portal_client_network_addr: string, + vpn_portal_client_network_len: number, + + advanced_settings: boolean, + + listener_urls: Array, + rpc_port: number, +} + +export const DEFAULT_NETWORK_CONFIG = (): NetworkConfig => { + return { + instance_id: uuidv4(), + + virtual_ipv4: "", + network_name: "default", + network_secret: "", + + networking_method: NetworkingMethod.PublicServer, + + public_server_url: "tcp://easytier.public.kkrainbow.top:11010", + peer_urls: [], + + proxy_cidrs: [], + + enable_vpn_portal: false, + vpn_portal_listne_port: 22022, + vpn_portal_client_network_addr: "", + vpn_portal_client_network_len: 24, + + advanced_settings: false, + + listener_urls: [ + "tcp://0.0.0.0:11010", + "udp://0.0.0.0:11010", + "wg://0.0.0.0:11011", + ], + rpc_port: 15888, + } +} + +export interface NetworkInstance { + instance_id: string, + + running: boolean, + error_msg: string, + + detail: any, +} \ No newline at end of file