mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Refactor: replace fetch with undici.request
This commit is contained in:
@@ -2,6 +2,7 @@ import { createReadlineInterfaceFromResponse } from './fetch-text-by-line';
|
||||
import { parse as tldtsParse } from 'tldts';
|
||||
import { $fetch } from './make-fetch-happen';
|
||||
import type { NodeFetchResponse } from './make-fetch-happen';
|
||||
import type { UndiciResponseData } from './fetch-retry';
|
||||
|
||||
function isDomainLoose(domain: string): boolean {
|
||||
const { isIcann, isPrivate, isIp } = tldtsParse(domain);
|
||||
@@ -15,7 +16,7 @@ export function extractDomainsFromFelixDnsmasq(line: string): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function parseFelixDnsmasqFromResp(resp: Response | NodeFetchResponse): Promise<string[]> {
|
||||
export async function parseFelixDnsmasqFromResp(resp: NodeFetchResponse | UndiciResponseData): Promise<string[]> {
|
||||
const results: string[] = [];
|
||||
|
||||
for await (const line of createReadlineInterfaceFromResponse(resp)) {
|
||||
|
||||
Reference in New Issue
Block a user