fix(sch): auto hostname type detection#3789
Merged
Merged
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
Contributor
There was a problem hiding this comment.
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
isPrivateIPhelper (extendsnet.IP.IsPrivatewith loopback, link-local, and RFC6598 CGNAT) and use it inDetectEndpointType. - 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
elena-kolevska
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Changes
DetectEndpointTypebehavior for hostname addresses (now DNS-resolves and may switch to*-ipwhen 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-ipeven 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 newinternal-ipbehavior. Separately, hardens the e2e log collector by tracking in-flightPrintfmatch callbacks soWaitForLogMatchFuncdoesn’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.