Fix DHT bootstrap URL parsing and transcoding completion handler
This commit is contained in:
parent
bbc7c259b4
commit
35db6597e3
@ -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
|
||||
}
|
||||
// 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
|
||||
}
|
||||
// Fallback for URLs without port
|
||||
return url
|
||||
return urlStr
|
||||
}
|
||||
|
||||
// isValidNodeID checks if a node ID is valid
|
||||
|
Loading…
x
Reference in New Issue
Block a user