27117900eb
Complete architecture rewrite following go2rtc patterns: - pkg/ for pure logic (camdb, tester, probe, generate) - internal/ for application glue with Init() modules - Single HTTP server on :4567 with all endpoints - zerolog with password masking and memory ring buffer - Environment-based config only (no YAML files) API endpoints: /api/search, /api/streams, /api/test, /api/probe, /api/generate, /api/health, /api/log Dependencies: go2rtc v1.9.14, go-sqlite3, miekg/dns, zerolog
22 lines
375 B
Go
22 lines
375 B
Go
package probe
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
"strings"
|
|
)
|
|
|
|
func ReverseDNS(ctx context.Context, ip string) (*DNSResult, error) {
|
|
names, err := net.DefaultResolver.LookupAddr(ctx, ip)
|
|
if err != nil || len(names) == 0 {
|
|
return nil, nil
|
|
}
|
|
|
|
hostname := strings.TrimSuffix(names[0], ".")
|
|
if hostname == "" {
|
|
return nil, nil
|
|
}
|
|
|
|
return &DNSResult{Hostname: hostname}, nil
|
|
}
|