mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 02:51:24 +00:00
Deduplicate more
This commit is contained in:
@@ -4,7 +4,7 @@ import type { Duplex } from "node:stream";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { createServer } from "node:http";
|
||||
import WebSocket, { WebSocketServer } from "ws";
|
||||
import { isLoopbackHost } from "../gateway/net.js";
|
||||
import { isLoopbackAddress, isLoopbackHost } from "../gateway/net.js";
|
||||
import { rawDataToString } from "../infra/ws.js";
|
||||
|
||||
type CdpCommand = {
|
||||
@@ -102,25 +102,6 @@ export type ChromeExtensionRelayServer = {
|
||||
stop: () => Promise<void>;
|
||||
};
|
||||
|
||||
function isLoopbackAddress(ip: string | undefined): boolean {
|
||||
if (!ip) {
|
||||
return false;
|
||||
}
|
||||
if (ip === "127.0.0.1") {
|
||||
return true;
|
||||
}
|
||||
if (ip.startsWith("127.")) {
|
||||
return true;
|
||||
}
|
||||
if (ip === "::1") {
|
||||
return true;
|
||||
}
|
||||
if (ip.startsWith("::ffff:127.")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseBaseUrl(raw: string): {
|
||||
host: string;
|
||||
port: number;
|
||||
|
||||
Reference in New Issue
Block a user