diff --git a/server.js b/server.js index 4cda91ae8..05b9cec7a 100644 --- a/server.js +++ b/server.js @@ -735,6 +735,8 @@ const preSetupTasks = async function () { /** * Gets the hostname to use for autorun in the browser. + * @param {boolean} useIPv6 If use IPv6 + * @param {boolean} useIPv4 If use IPv4 * @returns Promise The hostname to use for autorun */ async function getAutorunHostname(useIPv6, useIPv4) { @@ -861,6 +863,8 @@ function logSecurityAlert(message) { * Handles the case where the server failed to start on one or both protocols. * @param {boolean} v6Failed If the server failed to start on IPv6 * @param {boolean} v4Failed If the server failed to start on IPv4 + * @param {boolean} useIPv6 If use IPv6 + * @param {boolean} useIPv4 If use IPv4 */ function handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4) { if (v6Failed && !useIPv4) { @@ -882,6 +886,7 @@ function handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4) { /** * Creates an HTTPS server. * @param {URL} url The URL to listen on + * @param {number} ipVersion the ip version to use * @returns {Promise} A promise that resolves when the server is listening * @throws {Error} If the server fails to start */ @@ -909,6 +914,7 @@ function createHttpsServer(url, ipVersion) { /** * Creates an HTTP server. * @param {URL} url The URL to listen on + * @param {number} ipVersion the ip version to use * @returns {Promise} A promise that resolves when the server is listening * @throws {Error} If the server fails to start */ @@ -929,6 +935,12 @@ function createHttpServer(url, ipVersion) { }); } + +/** + * Starts the server using http or https depending on config + * @param {boolean} useIPv6 If use IPv6 + * @param {boolean} useIPv4 If use IPv4 + */ async function startHTTPorHTTPS(useIPv6, useIPv4) { let v6Failed = false; let v4Failed = false; diff --git a/src/util.js b/src/util.js index c11de84e8..07422a7ef 100644 --- a/src/util.js +++ b/src/util.js @@ -696,6 +696,7 @@ export function isValidUrl(url) { /** * removes starting `[` or ending `]` from hostname. * @param {string} hostname hostname to use + * @returns {string} hostname plus the modifications */ export function urlHostnameToIPv6(hostname) { if (hostname.startsWith('[')) { @@ -712,6 +713,7 @@ export function urlHostnameToIPv6(hostname) { * @param {string} name Domain name to use * @param {boolean} useIPv6 If use IPv6 * @param {boolean} useIPv4 If use IPv4 + * @returns Promise If the URL is valid */ export async function canResolve(name, useIPv6 = true, useIPv4 = true) { try { @@ -747,6 +749,7 @@ export async function canResolve(name, useIPv6 = true, useIPv4 = true) { /** * converts string to boolean accepts 'true' or 'false' else it returns the string put in * @param {string} str Input string + * @returns {boolean|string} boolean else original input string */ export function stringToBool(str) { if (str === 'true') return true;