20260726 修复rpki-explorer体验问题32项(#130):RocksDB max_open_files+compose ulimits、objects列表流式早停+scope前置(每页2.85s->10ms级)、未知/过期run统一404、runs倒序、导出文件名Content-Disposition、路径段percent_decode、nginx /api/v1代理与400回SPA;前端serialNumber schema、30s请求超时、reason筛选、组合VRP查询、导出反馈与repo/PP入口、键盘可达、cursor进URL、分页/对比度/skip-link等体验项
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
|
||||
export type NetworkQuery =
|
||||
| { kind: "ip"; ip: string }
|
||||
| { kind: "prefix"; prefix: string }
|
||||
| { kind: "ip"; ip: string; asn?: number }
|
||||
| { kind: "prefix"; prefix: string; asn?: number }
|
||||
| { kind: "asn"; asn: number }
|
||||
| { kind: "none" };
|
||||
|
||||
@@ -90,10 +90,30 @@ export function parsePrefix(input: string): string | null {
|
||||
* Classify a query string. Precedence: CIDR prefix → bare IP → ASN → none.
|
||||
* ("192.0.2.1" also parses as digits+ dots only; ASN requires pure digits, so
|
||||
* no overlap. A bare number is always treated as an ASN.)
|
||||
*
|
||||
* Two whitespace-separated tokens are read as a combined query — one network
|
||||
* token (IP or prefix) plus one ASN token (`AS13335` or `13335`), in either
|
||||
* order — yielding an ip/prefix query carrying an `asn` filter.
|
||||
*/
|
||||
export function classifyNetworkQuery(input: string): NetworkQuery {
|
||||
const s = input.trim();
|
||||
if (!s) return { kind: "none" };
|
||||
const tokens = s.split(/\s+/);
|
||||
if (tokens.length === 2) {
|
||||
for (const [netToken, asnToken] of [
|
||||
[tokens[0], tokens[1]],
|
||||
[tokens[1], tokens[0]],
|
||||
] as const) {
|
||||
const asn = parseAsn(asnToken);
|
||||
if (asn === null) continue;
|
||||
const prefix = parsePrefix(netToken);
|
||||
if (prefix) return { kind: "prefix", prefix, asn };
|
||||
const ip = parseIpAddress(netToken);
|
||||
if (ip) return { kind: "ip", ip, asn };
|
||||
}
|
||||
return { kind: "none" };
|
||||
}
|
||||
if (tokens.length > 2) return { kind: "none" };
|
||||
const prefix = parsePrefix(s);
|
||||
if (prefix) return { kind: "prefix", prefix };
|
||||
const ip = parseIpAddress(s);
|
||||
|
||||
Reference in New Issue
Block a user