mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-04 16:35:57 +00:00
tls: server: Various JSDoc fixes
This commit is contained in:
parent
9a8a14b466
commit
7dcbd21454
1 changed files with 17 additions and 21 deletions
|
@ -8,11 +8,7 @@ class TlsMonitorType extends MonitorType {
|
||||||
name = "port-tls";
|
name = "port-tls";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the periodic monitoring check on a TLS TCP port.
|
* @inheritdoc
|
||||||
* @param {Monitor} monitor Monitor to check
|
|
||||||
* @param {Heartbeat} heartbeat Monitor heartbeat to update
|
|
||||||
* @param {UptimeKumaServer} _server Uptime Kuma server (unused)
|
|
||||||
* @returns {Promise<void>} A fulfilled promise if the check succeeds, a rejected one otherwise
|
|
||||||
*/
|
*/
|
||||||
async check(monitor, heartbeat, _server) {
|
async check(monitor, heartbeat, _server) {
|
||||||
const options = {
|
const options = {
|
||||||
|
@ -60,11 +56,11 @@ class TlsMonitorType extends MonitorType {
|
||||||
/**
|
/**
|
||||||
* Compares the server's response against the monitor's attributes, decides on success/failure,
|
* Compares the server's response against the monitor's attributes, decides on success/failure,
|
||||||
* and updates the heartbeat accordingly.
|
* and updates the heartbeat accordingly.
|
||||||
* @param {string} response Response received from the server
|
* @param {string | Error} response Response received from the server or Error on failure
|
||||||
* @param {Monitor} monitor Monitor to check
|
* @param {Monitor} monitor Monitor to check
|
||||||
* @param {Heartbeat} heartbeat Monitor heartbeat to update
|
* @param {Heartbeat} heartbeat Monitor heartbeat to update
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
* @throws Error if the check fails
|
* @throws Error if the check has failed or the response does not match the expectations
|
||||||
*/
|
*/
|
||||||
processResponse(response, monitor, heartbeat) {
|
processResponse(response, monitor, heartbeat) {
|
||||||
if (response instanceof Error) {
|
if (response instanceof Error) {
|
||||||
|
@ -96,7 +92,7 @@ class TlsMonitorType extends MonitorType {
|
||||||
/**
|
/**
|
||||||
* Sends the request over the given TLS socket and returns the response.
|
* Sends the request over the given TLS socket and returns the response.
|
||||||
* @param {AbortController} aborter Abort controller used to abort the request
|
* @param {AbortController} aborter Abort controller used to abort the request
|
||||||
* @param {TLSSocket} tlsSocket TLS socket instance
|
* @param {tls.TLSSocket} tlsSocket TLS socket instance
|
||||||
* @param {*} options Monitor options
|
* @param {*} options Monitor options
|
||||||
* @returns {Promise<string>} Server response on success or rejected promise on error
|
* @returns {Promise<string>} Server response on success or rejected promise on error
|
||||||
*/
|
*/
|
||||||
|
@ -115,7 +111,7 @@ class TlsMonitorType extends MonitorType {
|
||||||
* @param {string} hostname Host to connect to
|
* @param {string} hostname Host to connect to
|
||||||
* @param {int} port TCP port to connect to
|
* @param {int} port TCP port to connect to
|
||||||
* @param {boolean} useStartTls True if STARTTLS should be used, false for native TLS
|
* @param {boolean} useStartTls True if STARTTLS should be used, false for native TLS
|
||||||
* @returns {Promise<TLSSocket>} TLS socket instance if successful or rejected promise on error
|
* @returns {Promise<tls.TLSSocket>} TLS socket instance if successful or rejected promise on error
|
||||||
*/
|
*/
|
||||||
async connect(aborter, hostname, port, useStartTls) {
|
async connect(aborter, hostname, port, useStartTls) {
|
||||||
if (useStartTls) {
|
if (useStartTls) {
|
||||||
|
@ -147,7 +143,7 @@ class TlsMonitorType extends MonitorType {
|
||||||
/**
|
/**
|
||||||
* Reads available data from the given socket.
|
* Reads available data from the given socket.
|
||||||
* @param {AbortController} aborter Abort controller used to abort the read
|
* @param {AbortController} aborter Abort controller used to abort the read
|
||||||
* @param {*} socket net.Socket or tls.TLSSocket instance to use
|
* @param {net.Socket | tls.TLSSocket} socket Socket instance to use
|
||||||
* @returns {Promise<string>} Data read from the socket or rejected promise on error
|
* @returns {Promise<string>} Data read from the socket or rejected promise on error
|
||||||
*/
|
*/
|
||||||
readData(aborter, socket) {
|
readData(aborter, socket) {
|
||||||
|
@ -189,7 +185,7 @@ class TlsMonitorType extends MonitorType {
|
||||||
/**
|
/**
|
||||||
* Reads available data from the given socket if it starts with a given prefix.
|
* Reads available data from the given socket if it starts with a given prefix.
|
||||||
* @param {AbortController} aborter Abort controller used to abort the read
|
* @param {AbortController} aborter Abort controller used to abort the read
|
||||||
* @param {*} socket net.Socket or tls.TLSSocket instance to use
|
* @param {net.Socket | tls.TLSSocket} socket Socket instance to use
|
||||||
* @param {string} expected Prefix the response is expected to start with
|
* @param {string} expected Prefix the response is expected to start with
|
||||||
* @returns {Promise<string>} Data read from the socket or rejected promise if the response does
|
* @returns {Promise<string>} Data read from the socket or rejected promise if the response does
|
||||||
* not start with the prefix
|
* not start with the prefix
|
||||||
|
@ -205,7 +201,7 @@ class TlsMonitorType extends MonitorType {
|
||||||
/**
|
/**
|
||||||
* Performs STARTTLS on the given socket.
|
* Performs STARTTLS on the given socket.
|
||||||
* @param {AbortController} aborter Abort controller used to abort the STARTTLS process
|
* @param {AbortController} aborter Abort controller used to abort the STARTTLS process
|
||||||
* @param {*} socket net.Socket or tls.TLSSocket instance to use
|
* @param {net.Socket | tls.TLSSocket} socket Socket instance to use
|
||||||
* @returns {Promise<void>} Rejected promise if the STARTTLS process failed
|
* @returns {Promise<void>} Rejected promise if the STARTTLS process failed
|
||||||
*/
|
*/
|
||||||
async startTls(aborter, socket) {
|
async startTls(aborter, socket) {
|
||||||
|
@ -219,8 +215,8 @@ class TlsMonitorType extends MonitorType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrades an unencrypted socket to a TLS socket using STARTTLS.
|
* Upgrades an unencrypted socket to a TLS socket using STARTTLS.
|
||||||
* @param {*} socket net.Socket representing the unencrypted connection
|
* @param {net.Socket} socket Socket representing the unencrypted connection
|
||||||
* @returns {Promise<TLSSocket>} tls.TLSSocket instance representing the upgraded TLS connection
|
* @returns {Promise<tls.TLSSocket>} Socket instance representing the upgraded TLS connection
|
||||||
* or rejected promise if the STARTTLS process failed
|
* or rejected promise if the STARTTLS process failed
|
||||||
*/
|
*/
|
||||||
upgradeConnection(socket) {
|
upgradeConnection(socket) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue