formatting changes

b43ac187ec606bce4f489a066e0960522e7d313d

BPplays <andymalbp@gmail.com>

2 files changed, +15 -0Ignore whitespace
server.js+12 -0
@@ -735,6 +735,8 @@ const preSetupTasks = async function () {
735735
736736/**
737737 * Gets the hostname to use for autorun in the browser.
738+ * @param {boolean} useIPv6 If use IPv6
739+ * @param {boolean} useIPv4 If use IPv4
738740 * @returns Promise<string> The hostname to use for autorun
739741 */
740742async function getAutorunHostname(useIPv6, useIPv4) {
@@ -861,6 +863,8 @@ function logSecurityAlert(message) {
861863 * Handles the case where the server failed to start on one or both protocols.
862864 * @param {boolean} v6Failed If the server failed to start on IPv6
863865 * @param {boolean} v4Failed If the server failed to start on IPv4
866+ * @param {boolean} useIPv6 If use IPv6
867+ * @param {boolean} useIPv4 If use IPv4
864868 */
865869function handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4) {
866870 if (v6Failed && !useIPv4) {
@@ -882,6 +886,7 @@ function handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4) {
882886/**
883887 * Creates an HTTPS server.
884888 * @param {URL} url The URL to listen on
889+ * @param {number} ipVersion the ip version to use
885890 * @returns {Promise<void>} A promise that resolves when the server is listening
886891 * @throws {Error} If the server fails to start
887892 */
@@ -909,6 +914,7 @@ function createHttpsServer(url, ipVersion) {
909914/**
910915 * Creates an HTTP server.
911916 * @param {URL} url The URL to listen on
917+ * @param {number} ipVersion the ip version to use
912918 * @returns {Promise<void>} A promise that resolves when the server is listening
913919 * @throws {Error} If the server fails to start
914920 */
@@ -929,6 +935,12 @@ function createHttpServer(url, ipVersion) {
929935 });
930936}
931937
938+
939+/**
940+ * Starts the server using http or https depending on config
941+ * @param {boolean} useIPv6 If use IPv6
942+ * @param {boolean} useIPv4 If use IPv4
943+ */
932944async function startHTTPorHTTPS(useIPv6, useIPv4) {
933945 let v6Failed = false;
934946 let v4Failed = false;
src/util.js+3 -0
@@ -696,6 +696,7 @@ export function isValidUrl(url) {
696696/**
697697 * removes starting `[` or ending `]` from hostname.
698698 * @param {string} hostname hostname to use
699+ * @returns {string} hostname plus the modifications
699700 */
700701export function urlHostnameToIPv6(hostname) {
701702 if (hostname.startsWith('[')) {
@@ -712,6 +713,7 @@ export function urlHostnameToIPv6(hostname) {
712713 * @param {string} name Domain name to use
713714 * @param {boolean} useIPv6 If use IPv6
714715 * @param {boolean} useIPv4 If use IPv4
716+ * @returns Promise<boolean> If the URL is valid
715717 */
716718export async function canResolve(name, useIPv6 = true, useIPv4 = true) {
717719 try {
@@ -747,6 +749,7 @@ export async function canResolve(name, useIPv6 = true, useIPv4 = true) {
747749/**
748750 * converts string to boolean accepts 'true' or 'false' else it returns the string put in
749751 * @param {string} str Input string
752+ * @returns {boolean|string} boolean else original input string
750753 */
751754export function stringToBool(str) {
752755 if (str === 'true') return true;