Skip to content

fix(sch): auto hostname type detection#3789

Merged
ndyakov merged 7 commits into
masterfrom
ndyakov/fix-detect-endpoint-type
Apr 23, 2026
Merged

fix(sch): auto hostname type detection#3789
ndyakov merged 7 commits into
masterfrom
ndyakov/fix-detect-endpoint-type

Conversation

@ndyakov

@ndyakov ndyakov commented Apr 23, 2026

Copy link
Copy Markdown
Member

Note

Medium Risk
Changes DetectEndpointType behavior for hostname addresses (now DNS-resolves and may switch to *-ip when TLS is off) and introduces bounded lookups/logging, which could affect connection classification and startup behavior in environments with unusual DNS.

Overview
Improves automatic endpoint type detection for maintenance notifications by replacing hostname heuristics with a DNS-based check: hostnames are resolved (with a 2s timeout) and classified as internal/external based on whether all returned IPs are private (including CGNAT), and with TLS disabled the auto mode now prefers internal-ip/external-ip even when configured with a hostname.

Adds handling for empty hosts like ":6379"/"", expands private-IP detection, and updates/extends tests (including timeout/cancel/error cases) and example instrumentation output to match the new internal-ip behavior. Separately, hardens the e2e log collector by tracking in-flight Printf match callbacks so WaitForLogMatchFunc doesn’t return while user closures may still be running.

Reviewed by Cursor Bugbot for commit 67b2480. Bugbot is set up for automated code reviews on this repo. Configure here.

@jit-ci

jit-ci Bot commented Apr 23, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates endpoint auto-detection to classify hostnames by resolving DNS (bounded by a timeout) instead of using naming heuristics, and expands “private/internal” IP detection to include RFC6598 CGNAT.

Changes:

  • Add isPrivateIP helper (extends net.IP.IsPrivate with loopback, link-local, and RFC6598 CGNAT) and use it in DetectEndpointType.
  • Replace hostname heuristics with DNS resolution (LookupIPAddr) under a 2s timeout to decide internal vs external FQDN.
  • Add unit tests covering private IP detection, endpoint type detection for IPs, and DNS resolution behavior/timeout bounds.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
maintnotifications/config.go Implements bounded DNS-based hostname classification and enhanced private IP detection (incl. CGNAT).
maintnotifications/config_test.go Adds tests for isPrivateIP, DNS-based hostname classification, and timeout behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread maintnotifications/config.go Outdated
Comment thread maintnotifications/config.go
Comment thread maintnotifications/config.go Outdated
ndyakov and others added 6 commits April 23, 2026 15:45
@ndyakov ndyakov merged commit 44e8b73 into master Apr 23, 2026
67 of 69 checks passed
@ndyakov ndyakov deleted the ndyakov/fix-detect-endpoint-type branch April 23, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants