Fix DHT bootstrap URL parsing and transcoding completion handler
Some checks are pending
CI Pipeline / Run Tests (push) Waiting to run
CI Pipeline / Lint Code (push) Waiting to run
CI Pipeline / Security Scan (push) Waiting to run
CI Pipeline / E2E Tests (push) Blocked by required conditions

This commit is contained in:
Enki 2025-08-27 18:08:49 -07:00
parent bbc7c259b4
commit 35db6597e3

View File

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"net"
"net/url"
"sync"
"time"
@ -518,13 +519,21 @@ func (d *DHTBootstrap) Stop() error {
// Helper functions
// extractHostname extracts hostname from URL
func extractHostname(url string) string {
// Simple URL parsing - in production use net/url
if host, _, err := net.SplitHostPort(url); err == nil {
func extractHostname(urlStr string) string {
// Parse the URL properly
if u, err := url.Parse(urlStr); err == nil {
// Extract hostname without port
if host, _, err := net.SplitHostPort(u.Host); err == nil {
return host
}
// Fallback for URLs without port
return url
// If no port in URL, return the host directly
return u.Host
}
// Fallback - assume it's already just a hostname
if host, _, err := net.SplitHostPort(urlStr); err == nil {
return host
}
return urlStr
}
// isValidNodeID checks if a node ID is valid