feat(Connections): Display rulePayload if possible (#655)

This commit is contained in:
tkhaos 2021-12-23 23:44:56 +08:00 committed by GitHub
parent e21d558996
commit 05691cc829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ function formatConnectionDataItem(
prevKv: Record<string, { upload: number; download: number }>,
now: number
): FormattedConn {
const { id, metadata, upload, download, start, chains, rule } = i;
const { id, metadata, upload, download, start, chains, rule, rulePayload } = i;
const { host, destinationPort, destinationIP, network, type, sourceIP, sourcePort } = metadata;
// host could be an empty string if it's direct IP connection
let host2 = host;
@ -88,7 +88,7 @@ function formatConnectionDataItem(
download,
start: now - new Date(start).valueOf(),
chains: chains.reverse().join(' / '),
rule,
rule: (rulePayload == null | rulePayload === '') ? rule : (`${rule}(${rulePayload})`),
...metadata,
host: `${host2}:${destinationPort}`,
type: `${type}(${network})`,