misc: addressed greptile comments 1

This commit is contained in:
Sheen Capadngan
2025-09-03 21:18:34 +08:00
parent e30cb9d767
commit ec39f84719
7 changed files with 33 additions and 12 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ import tls from "node:tls";
import https from "https";
import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";
import { splitPemChain } from "@app/services/certificate/certificate-fns";
import { BadRequestError } from "../errors";
@@ -27,12 +28,13 @@ const createProxyConnection = async ({
clientPrivateKey: string;
serverCertificateChain: string;
}): Promise<net.Socket> => {
const [host, portStr] = proxyIp.split(":");
const port = parseInt(portStr, 10) || 443;
const [targetHost] = await verifyHostInputValidity(proxyIp);
const [, portStr] = proxyIp.split(":");
const port = parseInt(portStr, 10) || 8443;
const serverCAs = splitPemChain(serverCertificateChain);
const tlsOptions: tls.ConnectionOptions = {
host,
host: targetHost,
port,
cert: clientCertificate,
key: clientPrivateKey,