feat(connection): add sniffHost support, #246

This commit is contained in:
kunish 2023-09-22 00:12:52 +08:00
parent 78360c8314
commit 2b16de18b0
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
5 changed files with 17 additions and 6 deletions

View File

@ -115,6 +115,7 @@ export enum CONNECTIONS_TABLE_ACCESSOR_KEY {
Type = 'type', Type = 'type',
Process = 'process', Process = 'process',
Host = 'host', Host = 'host',
SniffHost = 'sniffHost',
Rule = 'rules', Rule = 'rules',
Chains = 'chains', Chains = 'chains',
DlSpeed = 'dlSpeed', DlSpeed = 'dlSpeed',
@ -139,8 +140,6 @@ export const CONNECTIONS_TABLE_INITIAL_COLUMN_VISIBILITY = {
[CONNECTIONS_TABLE_ACCESSOR_KEY.ID]: false, [CONNECTIONS_TABLE_ACCESSOR_KEY.ID]: false,
} }
export const LOGS_TABLE_MAX_ROWS = 1000
export enum TAILWINDCSS_SIZE { export enum TAILWINDCSS_SIZE {
XS = 'xs', XS = 'xs',
SM = 'sm', SM = 'sm',
@ -163,6 +162,7 @@ export enum LOG_LEVEL {
} }
export const LOGS_TABLE_MAX_ROWS_LIST = [200, 300, 500, 800, 1000] export const LOGS_TABLE_MAX_ROWS_LIST = [200, 300, 500, 800, 1000]
export const DEFAULT_LOGS_TABLE_MAX_ROWS = LOGS_TABLE_MAX_ROWS_LIST[0]
export enum MODAL { export enum MODAL {
PROXIES_SETTINGS = 'proxies-settings', PROXIES_SETTINGS = 'proxies-settings',

View File

@ -24,6 +24,7 @@ export default {
name: 'Name', name: 'Name',
process: 'Process', process: 'Process',
host: 'Host', host: 'Host',
sniffHost: 'Sniff Host',
chains: 'Chains', chains: 'Chains',
connectTime: 'Time', connectTime: 'Time',
dlSpeed: 'DL Speed', dlSpeed: 'DL Speed',

View File

@ -24,6 +24,7 @@ export default {
name: '名字', name: '名字',
process: '进程', process: '进程',
host: '主机', host: '主机',
sniffHost: '嗅探域名',
chains: '链路', chains: '链路',
connectTime: '连接时间', connectTime: '连接时间',
dlSpeed: '下载速度', dlSpeed: '下载速度',

View File

@ -154,6 +154,11 @@ export default () => {
: original.metadata.destinationIP : original.metadata.destinationIP
}:${original.metadata.destinationPort}`, }:${original.metadata.destinationPort}`,
}, },
{
header: () => t('sniffHost'),
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.SniffHost,
accessorFn: (original) => original.metadata.sniffHost || '-',
},
{ {
header: () => t('rules'), header: () => t('rules'),
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Rule, accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Rule,

View File

@ -3,6 +3,7 @@ import { createSignal } from 'solid-js'
import { import {
CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER, CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER,
CONNECTIONS_TABLE_INITIAL_COLUMN_VISIBILITY, CONNECTIONS_TABLE_INITIAL_COLUMN_VISIBILITY,
DEFAULT_LOGS_TABLE_MAX_ROWS,
LATENCY_QUALITY_MAP_HTTP, LATENCY_QUALITY_MAP_HTTP,
LATENCY_QUALITY_MAP_HTTPS, LATENCY_QUALITY_MAP_HTTPS,
LOG_LEVEL, LOG_LEVEL,
@ -95,10 +96,13 @@ export const [logLevel, setLogLevel] = makePersisted(
createSignal<LOG_LEVEL>(LOG_LEVEL.Info), createSignal<LOG_LEVEL>(LOG_LEVEL.Info),
{ name: 'logLevel', storage: localStorage }, { name: 'logLevel', storage: localStorage },
) )
export const [logMaxRows, setLogMaxRows] = makePersisted(createSignal(300), { export const [logMaxRows, setLogMaxRows] = makePersisted(
name: 'logMaxRows', createSignal(DEFAULT_LOGS_TABLE_MAX_ROWS),
storage: localStorage, {
}) name: 'logMaxRows',
storage: localStorage,
},
)
export const tableSizeClassName = (size: TAILWINDCSS_SIZE) => { export const tableSizeClassName = (size: TAILWINDCSS_SIZE) => {
let className = 'table-xs' let className = 'table-xs'