Compare commits
7
Commits
80bb7d45f8
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecbc523ab6 | ||
|
|
c3a471553f | ||
|
|
c341d70f73 | ||
|
|
cb29c8e392 | ||
|
|
ce7a250309 | ||
|
|
c0bf77b88c | ||
|
|
306e2e52d2 |
@@ -1,4 +1,4 @@
|
||||
# ekekDNSHelper
|
||||
# ekDNSHelper
|
||||
|
||||
A cross-platform CLI tool that resolves hostnames against DNS servers and writes the resulting IP-to-hostname mappings into the local hosts file. It manages a clearly delimited block within the hosts file so it can cleanly add and remove only its own entries.
|
||||
|
||||
@@ -6,7 +6,7 @@ By default, ekdns performs **smart resolution**: it discovers the authoritative
|
||||
|
||||
Built as a single static binary with no runtime dependencies.
|
||||
|
||||
**Copyright (c) 2024 Emberkom LLC**
|
||||
**Copyright (c) 2026 Emberkom LLC**
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
@@ -78,13 +78,14 @@ if (-not (Test-Path $OutputDir)) {
|
||||
Write-Host "Created output directory: $OutputDir" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Build flags — always inject version; release builds also strip debug symbols.
|
||||
$versionLdflag = "-X main.version=$gitTag"
|
||||
# Build flags — always inject version and copyright year; release builds also strip debug symbols.
|
||||
$buildYear = (Get-Date).Year
|
||||
$injectedFlags = "-X main.version=$gitTag -X main.copyrightYear=$buildYear"
|
||||
if ($Release) {
|
||||
$ldflags = "-s -w $versionLdflag"
|
||||
$ldflags = "-s -w $injectedFlags"
|
||||
Write-Host "Building RELEASE version (optimized, no debug symbols)..." -ForegroundColor Green
|
||||
} else {
|
||||
$ldflags = $versionLdflag
|
||||
$ldflags = $injectedFlags
|
||||
Write-Host "Building DEBUG version (with debug symbols)..." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@ import (
|
||||
"ekdns/resolver"
|
||||
)
|
||||
|
||||
// version is set at build time via -ldflags "-X main.version=..."
|
||||
// version and copyrightYear are set at build time via -ldflags.
|
||||
var version = "dev"
|
||||
var copyrightYear = "2024"
|
||||
|
||||
func main() {
|
||||
// Banner (always printed to stdout).
|
||||
fmt.Printf("ekDNSHelper %s\n", version)
|
||||
fmt.Println("Copyright (c) 2024 Emberkom LLC")
|
||||
fmt.Printf("Copyright (c) %s Emberkom LLC\n", copyrightYear)
|
||||
fmt.Println("")
|
||||
|
||||
if len(os.Args) < 2 {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
-3
@@ -85,11 +85,19 @@ func resolveDefault(hostname string, pool []string, localResolvers []string, con
|
||||
if authority != nil {
|
||||
fmt.Fprintf(w, "[dns] Selected authority: %s → %s\n",
|
||||
authority.Zone, strings.Join(authority.Nameservers, ", "))
|
||||
return resolveAuthoritative(ctx, authority, hostname, pool, localResolvers, config, depth, w)
|
||||
ips, err := resolveAuthoritative(ctx, authority, hostname, pool, localResolvers, config, depth, w)
|
||||
if err == nil {
|
||||
return ips, nil
|
||||
}
|
||||
// Stage 2 failed (e.g. sub-zone delegation referral not followed) —
|
||||
// fall through to Stage 3 parallel A fallback.
|
||||
fmt.Fprintf(w, "[dns] Stage 2 failed: %v\n", err)
|
||||
fmt.Fprintf(w, "[dns] Falling back to Stage 3 parallel A queries\n")
|
||||
} else {
|
||||
fmt.Fprintf(w, "[dns] Stage 1: No NS records found at any level\n")
|
||||
}
|
||||
|
||||
// Stage 3: No NS records found — fall back to parallel A queries.
|
||||
fmt.Fprintf(w, "[dns] Stage 1: No NS records found at any level\n")
|
||||
// Stage 3: Fall back to parallel recursive A queries.
|
||||
ips, err := ParallelAFallback(ctx, w, pool, hostname, timeout)
|
||||
if err != nil {
|
||||
return nil, addPrivateTLDHint(hostname, err)
|
||||
|
||||
Reference in New Issue
Block a user