fix some build errors

This commit is contained in:
eyedeekay
2025-04-10 20:12:49 -04:00
parent 66c28e7b5e
commit 69bb5db15a

View File

@ -5,9 +5,7 @@ import (
"fmt"
"net"
"net/http"
"net/url"
"os"
"strings"
"github.com/go-i2p/go-meta-listener/mirror"
)
@ -48,27 +46,3 @@ func init() {
http.DefaultClient = httpClient
http.DefaultTransport = httpClient.Transport
}
func Dial(network, addr string) (net.Conn, error) {
// convert the addr to a URL
url, err := url.Parse(addr)
if err != nil {
return nil, err
}
// get the domain name
domain := url.Hostname()
// get the top-level domain
fr := strings.Split(domain, ".")
tld := fr[len(fr)-1]
switch tld {
case "i2p":
// I2P is a special case, we need to use the garlic dialer
return Garlic.Dial(addr)
case "onion":
// Onion is a special case, we need to use the onion dialer
return Onion.Dial(addr)
default:
// For everything else, we can use the default dialer
return net.Dial(network, addr)
}
}