Merge pull request #275 from dnomd343/master

fix: 流量信息匹配错误
This commit is contained in:
xream 2024-01-20 22:40:13 +08:00 committed by GitHub
commit 9b6d9d49f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,13 +88,13 @@ export async function getFlowHeaders(rawUrl, ua, timeout) {
export function parseFlowHeaders(flowHeaders) {
if (!flowHeaders) return;
// unit is KB
const uploadMatch = flowHeaders.match(/upload=(-?)(\d+)/);
const uploadMatch = flowHeaders.match(/upload=(-?)([E+.\d]+)/);
const upload = Number(uploadMatch[1] + uploadMatch[2]);
const downloadMatch = flowHeaders.match(/download=(-?)(\d+)/);
const downloadMatch = flowHeaders.match(/download=(-?)([E+.\d]+)/);
const download = Number(downloadMatch[1] + downloadMatch[2]);
const total = Number(flowHeaders.match(/total=(\d+)/)[1]);
const total = Number(flowHeaders.match(/total=([E+.\d]+)/)[1]);
// optional expire timestamp
const match = flowHeaders.match(/expire=(\d+)/);