55 lines
997 B
TypeScript
55 lines
997 B
TypeScript
import { Node, Edge } from '@xyflow/react';
|
|
|
|
export type AppNode = Node<NodeData>;
|
|
|
|
export type AppEdge = Edge<EdgeData>;
|
|
|
|
export interface GroupAllowRule {
|
|
kind: 'group'
|
|
allowGroup: number
|
|
}
|
|
|
|
export interface HostAllowRule {
|
|
kind: 'host'
|
|
allowHost: number
|
|
}
|
|
|
|
export interface CustomAllowRule {
|
|
kind: 'custom'
|
|
allow: string
|
|
}
|
|
|
|
export type AllowRule = GroupAllowRule | HostAllowRule | CustomAllowRule
|
|
|
|
export type NodeData = {
|
|
// basic
|
|
label: string;
|
|
privateKey: string;
|
|
groupId: number;
|
|
hostId: number;
|
|
|
|
// host options
|
|
postUp?: string;
|
|
postDown?: string;
|
|
mtu?: number;
|
|
notes?: string;
|
|
listenPort?: number;
|
|
dnsServers?: string;
|
|
|
|
// peer options
|
|
// allowRules?: AllowRule[];
|
|
// persistentKeepalive?: string; todo: 加到边上
|
|
}
|
|
|
|
export type Settings = {
|
|
v4SubNetPrefix: [number, number];
|
|
listenPort: number;
|
|
|
|
// options
|
|
v6SubNetPrefix?: [string, string, string, string];
|
|
mtu?: number;
|
|
}
|
|
|
|
export type EdgeData = {
|
|
isTwoWayEdge: boolean
|
|
} |