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',
Process = 'process',
Host = 'host',
SniffHost = 'sniffHost',
Rule = 'rules',
Chains = 'chains',
DlSpeed = 'dlSpeed',
@ -139,8 +140,6 @@ export const CONNECTIONS_TABLE_INITIAL_COLUMN_VISIBILITY = {
[CONNECTIONS_TABLE_ACCESSOR_KEY.ID]: false,
}
export const LOGS_TABLE_MAX_ROWS = 1000
export enum TAILWINDCSS_SIZE {
XS = 'xs',
SM = 'sm',
@ -163,6 +162,7 @@ export enum LOG_LEVEL {
}
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 {
PROXIES_SETTINGS = 'proxies-settings',

View File

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

View File

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

View File

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

View File

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