fix: use global multiaddr definitions

So we don't have to import a DNS resolver just to parse dns multiaddrs.
This commit is contained in:
Steven Allen 2019-09-18 16:53:12 -07:00
parent 082ac9ffc3
commit abe95b8d2e
3 changed files with 7 additions and 11 deletions

View File

@ -6,7 +6,6 @@ import (
"path/filepath"
ma "github.com/multiformats/go-multiaddr"
madns "github.com/multiformats/go-multiaddr-dns"
)
var errIncorrectNetAddr = fmt.Errorf("incorrect network addr conversion")
@ -131,12 +130,12 @@ func DialArgs(m ma.Multiaddr) (string, string, error) {
network = "ip4"
ip = c.Value()
return true
case madns.Dns4Protocol.Code:
case ma.P_DNS4:
network = "ip4"
hostname = true
ip = c.Value()
return true
case madns.Dns6Protocol.Code:
case ma.P_DNS6:
network = "ip6"
hostname = true
ip = c.Value()

7
go.mod
View File

@ -1,6 +1,5 @@
module github.com/multiformats/go-multiaddr-net
require (
github.com/multiformats/go-multiaddr v0.0.1
github.com/multiformats/go-multiaddr-dns v0.0.1
)
require github.com/multiformats/go-multiaddr v0.1.0
go 1.12

6
go.sum
View File

@ -8,10 +8,8 @@ github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XC
github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ=
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY=
github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc=
github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr v0.1.0 h1:fkISCUNDb3xIpCcI6BGlPsQE+ywcxzimOsUnHWnrE74=
github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ=
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE=