mirror of
https://github.com/go-i2p/go-gitlooseleaf.git
synced 2025-07-05 10:24:42 -04:00
fix some build errors
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user