From abe95b8d2eb1869d71dc51e95c750f8e8b8ecc4c Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 18 Sep 2019 16:53:12 -0700 Subject: [PATCH 1/2] fix: use global multiaddr definitions So we don't have to import a DNS resolver just to parse dns multiaddrs. --- convert.go | 5 ++--- go.mod | 7 +++---- go.sum | 6 ++---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/convert.go b/convert.go index 061f1c4..b1e5446 100644 --- a/convert.go +++ b/convert.go @@ -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() diff --git a/go.mod b/go.mod index 57c2827..bb2ec44 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index fc801ca..87f7a09 100644 --- a/go.sum +++ b/go.sum @@ -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= From de67c9ba29c74881029ee572a7d9b3a59a012f3d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 18 Sep 2019 16:59:15 -0700 Subject: [PATCH 2/2] remove gx support --- .travis.yml | 4 +--- README.md | 18 ++---------------- package.json | 30 ------------------------------ 3 files changed, 3 insertions(+), 49 deletions(-) delete mode 100644 package.json diff --git a/.travis.yml b/.travis.yml index 18f4287..336deb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,12 @@ os: language: go go: - - 1.11.x + - 1.12.x env: global: - GOTFLAGS="-race" matrix: - - BUILD_DEPTYPE=gx - BUILD_DEPTYPE=gomod @@ -24,7 +23,6 @@ script: cache: directories: - - $GOPATH/src/gx - $GOPATH/pkg/mod - /home/travis/.cache/go-build diff --git a/README.md b/README.md index c13d248..e9ad25f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # go-multiaddr-net -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) +[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) [![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) [![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) @@ -35,21 +35,7 @@ Note that `go-multiaddr-net` is packaged with Gx, so it is recommended to use Gx ## Usage -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project do: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/multiformats/go-multiaddr-net -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -For further usage, see the docs: +See the docs: - `multiaddr/net`: https://godoc.org/github.com/multiformats/go-multiaddr-net - `multiaddr`: https://godoc.org/github.com/multiformats/go-multiaddr diff --git a/package.json b/package.json deleted file mode 100644 index cdad09e..0000000 --- a/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "multiformats", - "bugs": { - "url": "https://github.com/multiformats/go-multiaddr-net" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-multiaddr-net" - }, - "gxDependencies": [ - { - "author": "multiformats", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - }, - { - "author": "lgierth", - "hash": "QmU98UaAEh4WJAcir2qjfztU77JQ14kAwHNFkjUXHZA3Vy", - "name": "go-multiaddr-dns", - "version": "0.3.1" - } - ], - "gxVersion": "0.6.0", - "language": "go", - "license": "", - "name": "go-multiaddr-net", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.7.2" -} -