Fix DHT bootstrap URL parsing and transcoding completion handler
This commit is contained in:
parent
bbc7c259b4
commit
35db6597e3
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"net/url"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -518,13 +519,21 @@ func (d *DHTBootstrap) Stop() error {
|
|||||||
// Helper functions
|
// Helper functions
|
||||||
|
|
||||||
// extractHostname extracts hostname from URL
|
// extractHostname extracts hostname from URL
|
||||||
func extractHostname(url string) string {
|
func extractHostname(urlStr string) string {
|
||||||
// Simple URL parsing - in production use net/url
|
// Parse the URL properly
|
||||||
if host, _, err := net.SplitHostPort(url); err == nil {
|
if u, err := url.Parse(urlStr); err == nil {
|
||||||
|
// Extract hostname without port
|
||||||
|
if host, _, err := net.SplitHostPort(u.Host); err == nil {
|
||||||
return host
|
return host
|
||||||
}
|
}
|
||||||
// Fallback for URLs without port
|
// If no port in URL, return the host directly
|
||||||
return url
|
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
|
// isValidNodeID checks if a node ID is valid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user