From 716d60898b870f528de4cd546fd7d142717828e9 Mon Sep 17 00:00:00 2001 From: Username Date: Tue, 17 Feb 2026 18:37:44 +0100 Subject: [PATCH] config: allow checktype = none to disable secondary check Accepts none/false/off/disabled as checktype value, normalized to 'none' internally. When set, ssl_first is forced on and no Phase 2 check runs -- only successful TLS handshakes count as working. --- config.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index 50c23c7..04e985c 100644 --- a/config.py +++ b/config.py @@ -11,7 +11,12 @@ class Config(ComboParser): with open(self.watchd.source_file, 'r') as handle: self.servers = [x.strip() for x in handle.readlines() if len(x.strip()) > 0] # Parse checktypes as comma-separated list - self.watchd.checktypes = [t.strip() for t in self.watchd.checktype.split(',') if t.strip()] + # Normalize: 'false'/'off'/'disabled' -> 'none' (SSL-only mode) + raw_types = [t.strip().lower() for t in self.watchd.checktype.split(',') if t.strip()] + self.watchd.checktypes = ['none' if t in ('false', 'off', 'disabled') else t for t in raw_types] + # SSL-only mode: force ssl_first when secondary check is disabled + if self.watchd.checktypes == ['none']: + self.watchd.ssl_first = True # Apply log level from CLI flags if self.args.quiet: set_log_level('warn') @@ -52,12 +57,15 @@ class Config(ComboParser): errors.append('ppf.max_fail must be >= 1') # Validate checktypes (secondary check types, ssl is handled by ssl_first) - valid_checktypes = {'irc', 'head', 'judges'} + # 'none' = SSL-only mode (no secondary check) + valid_checktypes = {'irc', 'head', 'judges', 'none'} for ct in self.watchd.checktypes: if ct not in valid_checktypes: errors.append('watchd.checktype "%s" invalid, must be one of: %s' % (ct, ', '.join(sorted(valid_checktypes)))) if not self.watchd.checktypes: errors.append('watchd.checktype must specify at least one valid type') + if 'none' in self.watchd.checktypes and len(self.watchd.checktypes) > 1: + errors.append('watchd.checktype "none" cannot be combined with other types') # Validate engine names valid_engines = {'duckduckgo', 'startpage', 'brave', 'ecosia', @@ -112,7 +120,7 @@ class Config(ComboParser): self.add_item(section, 'stale_days', int, 30, 'days after which dead proxies are removed (default: 30)', False) self.add_item(section, 'stats_interval', int, 300, 'seconds between status reports (default: 300)', False) self.add_item(section, 'tor_safeguard', bool, True, 'enable tor safeguard (default: True)', False) - self.add_item(section, 'checktype', str, 'head', 'secondary check type: irc, head, judges (used when ssl_first fails)', False) + self.add_item(section, 'checktype', str, 'head', 'secondary check type: head, irc, judges, none/false (none = SSL-only)', False) self.add_item(section, 'ssl_first', bool, True, 'try SSL handshake first, fallback to checktype on failure (default: True)', False) self.add_item(section, 'ssl_only', bool, False, 'when ssl_first enabled, skip secondary check on SSL failure (default: False)', False) self.add_item(section, 'scale_cooldown', int, 10, 'seconds between thread scaling decisions (default: 10)', False)