diff --git a/go.mod b/go.mod index 3185638..d49deb6 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,18 @@ module github.com/go-i2p/go-gittisane -go 1.23.5 +go 1.24.2 require ( github.com/go-i2p/go-limit v0.0.0-20250203203118-210616857c15 + github.com/go-i2p/go-meta-dialer v0.0.0-20250501024057-715e91be3cfe github.com/go-i2p/go-meta-listener v0.0.4-0.20250501044535-ab41cecda529 - github.com/go-i2p/onramp v0.33.92 ) require ( github.com/cretz/bine v0.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-i2p/i2pkeys v0.33.10-0.20241113193422-e10de5e60708 // indirect + github.com/go-i2p/onramp v0.33.92 // indirect github.com/go-i2p/sam3 v0.33.9 // indirect github.com/opd-ai/wileedot v0.0.0-20241217172720-521d4175e624 // indirect github.com/pkg/errors v0.9.1 // indirect diff --git a/go.sum b/go.sum index a54d203..e58a096 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-i2p/go-limit v0.0.0-20250203203118-210616857c15 h1:ASjMbwlepoDQfrhv+H2B5ICBPJU5ES1JzmOxzPDx3YQ= github.com/go-i2p/go-limit v0.0.0-20250203203118-210616857c15/go.mod h1:4jjmVRhvKj47sQ6B6wdDhN1IrEZunE6KwkYLQx/BeVE= +github.com/go-i2p/go-meta-dialer v0.0.0-20250501024057-715e91be3cfe h1:9Rxw2KtMCRKZHI4WavUAaatzKmc64V6kiYvcyTMHjeU= +github.com/go-i2p/go-meta-dialer v0.0.0-20250501024057-715e91be3cfe/go.mod h1:++xHSOvnGymRSyFbi9A9hztcfwKfU6/nJAtVxrNo8Zo= github.com/go-i2p/go-meta-listener v0.0.4-0.20250501044535-ab41cecda529 h1:NjoB0lFjeIumL2r4h+ychfelK6Fnjsi2Lt9ia9exvf8= github.com/go-i2p/go-meta-listener v0.0.4-0.20250501044535-ab41cecda529/go.mod h1:wF/MCCfB40gZyT9WtuYWQkUOPrnoTzA+NG0zpsy3s4M= github.com/go-i2p/i2pkeys v0.0.0-20241108200332-e4f5ccdff8c4/go.mod h1:m5TlHjPZrU5KbTd7Lr+I2rljyC6aJ88HdkeMQXV0U0E= diff --git a/net_mirror_dialer.go b/net_mirror_dialer.go index 6e35675..efac3b7 100644 --- a/net_mirror_dialer.go +++ b/net_mirror_dialer.go @@ -2,43 +2,10 @@ package graceful import ( "net" - "net/url" - "strings" - "github.com/go-i2p/onramp" -) - -var ( - Garlic, GarlicErr = onramp.NewGarlic("git-looseleaf", "127.0.0.1:7656", onramp.OPT_WIDE) - Onion, OnionErr = onramp.NewOnion("git-looseleaf") + metadialer "github.com/go-i2p/go-meta-dialer" ) 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": - if GarlicErr != nil { - return nil, GarlicErr - } - // I2P is a special case, we need to use the garlic dialer - return Garlic.Dial("i2p", addr) - case "onion": - if OnionErr != nil { - return nil, OnionErr - } - // Onion is a special case, we need to use the onion dialer - return Onion.Dial("onion", addr) - default: - // For everything else, we can use the default dialer - return net.Dial(network, addr) - } + return metadialer.Dial(network, addr) }