formatting changes
| @@ -735,6 +735,8 @@ const preSetupTasks = async function () { | ||
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * Gets the hostname to use for autorun in the browser. |
| 738 | + * @param {boolean} useIPv6 If use IPv6 | |
| 739 | + * @param {boolean} useIPv4 If use IPv4 | |
| 738 | 740 | * @returns Promise<string> The hostname to use for autorun |
| 739 | 741 | */ |
| 740 | 742 | async function getAutorunHostname(useIPv6, useIPv4) { |
| @@ -861,6 +863,8 @@ function logSecurityAlert(message) { | ||
| 861 | 863 | * Handles the case where the server failed to start on one or both protocols. |
| 862 | 864 | * @param {boolean} v6Failed If the server failed to start on IPv6 |
| 863 | 865 | * @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 | |
| 864 | 868 | */ |
| 865 | 869 | function handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4) { |
| 866 | 870 | if (v6Failed && !useIPv4) { |
| @@ -882,6 +886,7 @@ function handleServerListenFail(v6Failed, v4Failed, useIPv6, useIPv4) { | ||
| 882 | 886 | /** |
| 883 | 887 | * Creates an HTTPS server. |
| 884 | 888 | * @param {URL} url The URL to listen on |
| 889 | + * @param {number} ipVersion the ip version to use | |
| 885 | 890 | * @returns {Promise<void>} A promise that resolves when the server is listening |
| 886 | 891 | * @throws {Error} If the server fails to start |
| 887 | 892 | */ |
| @@ -909,6 +914,7 @@ function createHttpsServer(url, ipVersion) { | ||
| 909 | 914 | /** |
| 910 | 915 | * Creates an HTTP server. |
| 911 | 916 | * @param {URL} url The URL to listen on |
| 917 | + * @param {number} ipVersion the ip version to use | |
| 912 | 918 | * @returns {Promise<void>} A promise that resolves when the server is listening |
| 913 | 919 | * @throws {Error} If the server fails to start |
| 914 | 920 | */ |
| @@ -929,6 +935,12 @@ function createHttpServer(url, ipVersion) { | ||
| 929 | 935 | }); |
| 930 | 936 | } |
| 931 | 937 | |
| 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 | + */ | |
| 932 | 944 | async function startHTTPorHTTPS(useIPv6, useIPv4) { |
| 933 | 945 | let v6Failed = false; |
| 934 | 946 | let v4Failed = false; |
| @@ -696,6 +696,7 @@ export function isValidUrl(url) { | ||
| 696 | 696 | /** |
| 697 | 697 | * removes starting `[` or ending `]` from hostname. |
| 698 | 698 | * @param {string} hostname hostname to use |
| 699 | + * @returns {string} hostname plus the modifications | |
| 699 | 700 | */ |
| 700 | 701 | export function urlHostnameToIPv6(hostname) { |
| 701 | 702 | if (hostname.startsWith('[')) { |
| @@ -712,6 +713,7 @@ export function urlHostnameToIPv6(hostname) { | ||
| 712 | 713 | * @param {string} name Domain name to use |
| 713 | 714 | * @param {boolean} useIPv6 If use IPv6 |
| 714 | 715 | * @param {boolean} useIPv4 If use IPv4 |
| 716 | + * @returns Promise<boolean> If the URL is valid | |
| 715 | 717 | */ |
| 716 | 718 | export async function canResolve(name, useIPv6 = true, useIPv4 = true) { |
| 717 | 719 | try { |
| @@ -747,6 +749,7 @@ export async function canResolve(name, useIPv6 = true, useIPv4 = true) { | ||
| 747 | 749 | /** |
| 748 | 750 | * converts string to boolean accepts 'true' or 'false' else it returns the string put in |
| 749 | 751 | * @param {string} str Input string |
| 752 | + * @returns {boolean|string} boolean else original input string | |
| 750 | 753 | */ |
| 751 | 754 | export function stringToBool(str) { |
| 752 | 755 | if (str === 'true') return true; |