/**
Copyright: 2024 Contrast Security, Inc
  Contact: support@contrastsecurity.com
  License: Commercial

  NOTICE: This Software and the patented inventions embodied within may only be
  used as part of Contrast Security’s commercial offerings. Even though it is
  made available through public repositories, use of this Software is subject to
  the applicable End User Licensing Agreement found at
  https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
  between Contrast Security and the End User. The Software may not be reverse
  engineered, modified, repackaged, sold, redistributed or otherwise used in a
  way not consistent with the End User License Agreement.
*/
'use strict';

const CONNECT_FAILURE_ERRORS = ['ENOENT', 'ECONNREFUSED'];

const MAX_START_WAIT_MS = 3000;

const RESEND_WAIT_MS = 50;
const FAST_FAIL_MS = 10000;
const MAX_FAST_FAILURES = 3;

const CONNECTION_STATES = {
  FAILURE: 'FAILURE',
  SUCCESS: 'SUCCESS',
  UNKNOWN: 'UNKNOWN'
};

const INIT_STATES = {
  READY: 'READY',
  STARTING: 'STARTING',
  UNKNOWN: 'UNKNOWN'
};

const TERM_SIGNALS = [
  'SIGABRT',
  'SIGALRM',
  'SIGEMT',
  'SIGHUP',
  'SIGINT',
  'SIGIO',
  'SIGIOT',
  'SIGLOST',
  'SIGPOLL',
  'SIGPWR',
  'SIGQUIT',
  'SIGSTKFLT',
  'SIGSYS',
  'SIGTERM',
  'SIGTRAP',
  'SIGUNUSED',
  'SIGUSR2',
  'SIGVTALRM',
  'SIGXCPU'
];

module.exports = {
  CONNECT_FAILURE_ERRORS,
  CONNECTION_STATES,
  INIT_STATES,
  MAX_START_WAIT_MS,
  RESEND_WAIT_MS,
  FAST_FAIL_MS,
  MAX_FAST_FAILURES,
  TERM_SIGNALS
};
