mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Chore: make ESLint Happy
This commit is contained in:
@@ -3,19 +3,19 @@ import { parse as tldtsParse } from 'tldts';
|
||||
import { $fetch } from './make-fetch-happen';
|
||||
import type { NodeFetchResponse } from './make-fetch-happen';
|
||||
|
||||
const isDomainLoose = (domain: string): boolean => {
|
||||
function isDomainLoose(domain: string): boolean {
|
||||
const { isIcann, isPrivate, isIp } = tldtsParse(domain);
|
||||
return !!(!isIp && (isIcann || isPrivate));
|
||||
};
|
||||
}
|
||||
|
||||
export const extractDomainsFromFelixDnsmasq = (line: string): string | null => {
|
||||
export function extractDomainsFromFelixDnsmasq(line: string): string | null {
|
||||
if (line.startsWith('server=/') && line.endsWith('/114.114.114.114')) {
|
||||
return line.slice(8, -16);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
export const parseFelixDnsmasqFromResp = async (resp: Response | NodeFetchResponse): Promise<string[]> => {
|
||||
export async function parseFelixDnsmasqFromResp(resp: Response | NodeFetchResponse): Promise<string[]> {
|
||||
const results: string[] = [];
|
||||
|
||||
for await (const line of createReadlineInterfaceFromResponse(resp)) {
|
||||
@@ -26,9 +26,9 @@ export const parseFelixDnsmasqFromResp = async (resp: Response | NodeFetchRespon
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
}
|
||||
|
||||
export const parseFelixDnsmasq = async (url: string): Promise<string[]> => {
|
||||
export async function parseFelixDnsmasq(url: string): Promise<string[]> {
|
||||
const resp = await $fetch(url);
|
||||
return parseFelixDnsmasqFromResp(resp);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user