summaryrefslogtreecommitdiff
path: root/src/store/connections.ts
blob: 6f4b55fba556578bf69e13293e77b124830c0df3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { atom } from 'recoil';

export type FormattedConn = {
  id: string;
  upload: number;
  download: number;
  start: number;
  startTime?: number;
  chains: string;
  rule: string;
  destinationPort: string;
  destinationIP: string;
  remoteDestination: string;
  sourceIP: string;
  sourcePort: string;
  source: string;
  host: string;
  sniffHost: string;
  type: string;
  network: string;
  process?: string;
  downloadSpeedCurr?: number;
  uploadSpeedCurr?: number;
};

// 当前活跃连接
export const connectionsState = atom<FormattedConn[]>({
  key: 'connectionsState',
  default: [],
});

// 已关闭连接
export const closedConnectionsState = atom<FormattedConn[]>({
  key: 'closedConnectionsState',
  default: [],
});

// 连接刷新暂停状态
export const isRefreshPausedState = atom<boolean>({
  key: 'isRefreshPausedState',
  default: false,
});

// 最大已关闭连接数量限制
export const MAX_CLOSED_CONNECTIONS = 100;