2023-09-03 17:32:08 +08:00
|
|
|
import { ApexOptions } from 'apexcharts'
|
|
|
|
import byteSize from 'byte-size'
|
|
|
|
|
2023-08-24 04:20:53 +08:00
|
|
|
export const themes = [
|
|
|
|
'light',
|
|
|
|
'dark',
|
|
|
|
'cupcake',
|
|
|
|
'bumblebee',
|
|
|
|
'emerald',
|
|
|
|
'corporate',
|
|
|
|
'synthwave',
|
|
|
|
'retro',
|
|
|
|
'cyberpunk',
|
|
|
|
'valentine',
|
|
|
|
'halloween',
|
|
|
|
'garden',
|
|
|
|
'forest',
|
|
|
|
'aqua',
|
|
|
|
'lofi',
|
|
|
|
'pastel',
|
|
|
|
'fantasy',
|
|
|
|
'wireframe',
|
|
|
|
'black',
|
|
|
|
'luxury',
|
|
|
|
'dracula',
|
|
|
|
'cmyk',
|
|
|
|
'autumn',
|
|
|
|
'business',
|
|
|
|
'acid',
|
|
|
|
'lemonade',
|
|
|
|
'night',
|
|
|
|
'coffee',
|
|
|
|
'winter',
|
|
|
|
]
|
2023-09-03 03:26:29 +08:00
|
|
|
|
2023-09-03 03:36:12 +08:00
|
|
|
export enum ROUTES {
|
2023-09-03 03:26:29 +08:00
|
|
|
Overview = '/overview',
|
|
|
|
Proxies = '/proxies',
|
|
|
|
Rules = '/rules',
|
|
|
|
Conns = '/conns',
|
|
|
|
Log = '/logs',
|
|
|
|
Config = '/config',
|
2023-09-04 13:08:05 +08:00
|
|
|
Setup = '/setup',
|
2023-09-03 03:26:29 +08:00
|
|
|
}
|
|
|
|
|
2023-09-03 17:32:08 +08:00
|
|
|
export const CHART_MAX_XAXIS = 10
|
|
|
|
|
|
|
|
export const DEFAULT_CHART_OPTIONS: ApexOptions = {
|
2023-09-06 13:13:58 +08:00
|
|
|
title: { align: 'center', style: { color: 'gray', fontSize: '16px' } },
|
2023-09-03 17:32:08 +08:00
|
|
|
chart: {
|
|
|
|
toolbar: { show: false },
|
|
|
|
zoom: { enabled: false },
|
|
|
|
animations: { easing: 'linear' },
|
|
|
|
},
|
|
|
|
noData: { text: 'Loading...' },
|
|
|
|
legend: {
|
2023-09-04 23:35:40 +08:00
|
|
|
showForSingleSeries: true,
|
2023-09-06 13:13:58 +08:00
|
|
|
fontSize: '16px',
|
2023-09-03 17:32:08 +08:00
|
|
|
labels: { colors: 'gray' },
|
2023-09-04 23:35:40 +08:00
|
|
|
itemMargin: { horizontal: 32 },
|
2023-09-03 17:32:08 +08:00
|
|
|
},
|
|
|
|
dataLabels: { enabled: false },
|
|
|
|
grid: { yaxis: { lines: { show: false } } },
|
|
|
|
stroke: { curve: 'smooth' },
|
|
|
|
tooltip: { enabled: false },
|
|
|
|
xaxis: {
|
|
|
|
range: CHART_MAX_XAXIS,
|
|
|
|
labels: { show: false },
|
|
|
|
axisTicks: { show: false },
|
|
|
|
},
|
|
|
|
yaxis: {
|
|
|
|
labels: {
|
2023-09-06 13:13:58 +08:00
|
|
|
style: { colors: 'gray', fontSize: '13px' },
|
2023-09-03 17:32:08 +08:00
|
|
|
formatter: (val) => byteSize(val).toString(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-09-03 03:56:04 +08:00
|
|
|
export enum LATENCY_QUALITY_MAP_HTTP {
|
2023-09-03 05:35:08 +08:00
|
|
|
NOT_CONNECTED = -1,
|
2023-09-03 03:26:29 +08:00
|
|
|
MEDIUM = 200,
|
|
|
|
HIGH = 500,
|
|
|
|
}
|
|
|
|
|
2023-09-03 03:56:04 +08:00
|
|
|
export enum LATENCY_QUALITY_MAP_HTTPS {
|
2023-09-03 05:35:08 +08:00
|
|
|
NOT_CONNECTED = -1,
|
2023-09-03 03:56:04 +08:00
|
|
|
MEDIUM = 800,
|
|
|
|
HIGH = 1500,
|
|
|
|
}
|
|
|
|
|
2023-09-03 03:26:29 +08:00
|
|
|
export enum PROXIES_PREVIEW_TYPE {
|
|
|
|
OFF = 'off',
|
|
|
|
DOTS = 'dots',
|
|
|
|
BAR = 'bar',
|
|
|
|
Auto = 'auto',
|
|
|
|
}
|
|
|
|
|
2023-09-03 05:35:08 +08:00
|
|
|
export enum PROXIES_ORDERING_TYPE {
|
2023-09-03 03:26:29 +08:00
|
|
|
NATURAL = 'orderNatural',
|
|
|
|
LATENCY_ASC = 'orderLatency_asc',
|
|
|
|
LATENCY_DESC = 'orderLatency_desc',
|
|
|
|
NAME_ASC = 'orderName_asc',
|
|
|
|
NAME_DESC = 'orderName_desc',
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum LANG {
|
|
|
|
EN = 'en-US',
|
|
|
|
ZH = 'zh-CN',
|
|
|
|
}
|
|
|
|
|
2023-09-03 03:36:12 +08:00
|
|
|
export enum CONNECTIONS_TABLE_ACCESSOR_KEY {
|
2023-09-09 03:49:29 +08:00
|
|
|
Details = 'details',
|
2023-09-03 03:36:12 +08:00
|
|
|
Close = 'close',
|
|
|
|
ID = 'ID',
|
|
|
|
Type = 'type',
|
|
|
|
Process = 'process',
|
|
|
|
Host = 'host',
|
|
|
|
Rule = 'rules',
|
|
|
|
Chains = 'chains',
|
|
|
|
DlSpeed = 'dlSpeed',
|
|
|
|
ULSpeed = 'ulSpeed',
|
|
|
|
Download = 'dl',
|
|
|
|
Upload = 'ul',
|
2023-09-04 20:29:08 +08:00
|
|
|
ConnectTime = 'connectTime',
|
2023-09-06 11:55:12 +08:00
|
|
|
SourceIP = 'sourceIP',
|
|
|
|
SourcePort = 'sourcePort',
|
2023-09-03 03:36:12 +08:00
|
|
|
Destination = 'destination',
|
|
|
|
}
|
|
|
|
|
2023-09-10 19:16:06 +08:00
|
|
|
export const CONNECTIONS_TABLE_MAX_CLOSED_ROWS = 200
|
2023-09-10 18:47:01 +08:00
|
|
|
|
2023-09-03 03:36:12 +08:00
|
|
|
export const CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER = Object.values(
|
|
|
|
CONNECTIONS_TABLE_ACCESSOR_KEY,
|
|
|
|
)
|
|
|
|
export const CONNECTIONS_TABLE_INITIAL_COLUMN_VISIBILITY = {
|
|
|
|
...Object.fromEntries(
|
|
|
|
CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER.map((i) => [i, true]),
|
|
|
|
),
|
|
|
|
[CONNECTIONS_TABLE_ACCESSOR_KEY.ID]: false,
|
2023-09-03 03:26:29 +08:00
|
|
|
}
|
2023-09-05 20:53:00 +08:00
|
|
|
|
2023-09-10 19:03:26 +08:00
|
|
|
export const LOGS_TABLE_MAX_ROWS = 1000
|
|
|
|
|
2023-09-05 20:53:00 +08:00
|
|
|
export enum TAILWINDCSS_SIZE {
|
|
|
|
XS = 'xs',
|
|
|
|
SM = 'sm',
|
|
|
|
MD = 'md',
|
|
|
|
LG = 'lg',
|
|
|
|
}
|
2023-09-12 20:50:52 +08:00
|
|
|
|
|
|
|
export enum MODE_OPTIONS {
|
|
|
|
Global = 'global',
|
|
|
|
Rule = 'rule',
|
|
|
|
Direct = 'direct',
|
|
|
|
}
|
2023-09-14 16:49:39 +08:00
|
|
|
|
|
|
|
export enum LOG_LEVEL {
|
|
|
|
Info = 'info',
|
|
|
|
Error = 'error',
|
|
|
|
Warning = 'warning',
|
|
|
|
Debug = 'debug',
|
|
|
|
Silent = 'silent',
|
|
|
|
}
|
2023-09-14 18:31:52 +08:00
|
|
|
|
2023-09-14 18:33:27 +08:00
|
|
|
export const LOGS_TABLE_MAX_ROWS_LIST = [200, 300, 500, 800, 1000]
|