From a32f8f983edcb78fc1f410308953b3fa64d9c4b1 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 14 Feb 2018 17:59:52 +0100 Subject: [PATCH] Extract from go-ipfs: gxify, license, readme, travis, makefile --- .gx/lastpubver | 0 .travis.yml | 21 +++++++++++ LICENSE | 21 +++++++++++ Makefile | 18 +++++++++ README.md | 44 ++++++++++++++++++++++ mock/centralized_client.go | 24 ++++++------ mock/centralized_server.go | 13 +++---- mock/centralized_test.go | 10 ++--- mock/interface.go | 10 ++--- none/none_client.go | 11 +++--- offline/offline.go | 20 +++++----- offline/offline_test.go | 4 +- package.json | 76 ++++++++++++++++++++++++++++++++++++++ 13 files changed, 225 insertions(+), 47 deletions(-) create mode 100644 .gx/lastpubver create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 package.json diff --git a/.gx/lastpubver b/.gx/lastpubver new file mode 100644 index 0000000..e69de29 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..510211d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +sudo: false + +language: go +go: + - 1.9 + +install: + - go get github.com/whyrusleeping/gx + - go get github.com/whyrusleeping/gx-go +script: + - make test + +#after_success: +# - bash <(curl -s https://codecov.io/bash) + +cache: + directories: + - $GOPATH/src/gx + +notifications: +email: false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e4224df --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 IPFS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c12161c --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +all: deps +gx: + go get github.com/whyrusleeping/gx + go get github.com/whyrusleeping/gx-go +deps: gx + gx --verbose install --global + gx-go rewrite +test: deps + gx test -v -race ./... +rw: + gx-go rewrite +rwundo: + gx-go rewrite --undo +publish: rwundo + gx publish +.PHONY: all gx deps test rw rwundo publish + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..6361489 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# go-ipfs-routing + +[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) +[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) +[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) +[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-routing?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-routing) +[![Build Status](https://travis-ci.org/ipfs/go-ipfs-routing.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-routing) + +> go-ipfs-routing provides go-libp2p-routing implementations used in go-ipfs. + +## Table of Contents + +- [Install](#install) +- [Usage](#usage) +- [Contribute](#contribute) +- [License](#license) + +## Install + +`go-ipfs-routing` works like a regular Go module: + +``` +> go get github.com/ipfs/go-ipfs-routing +``` + +This module uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make all` to build it with the `gx` dependencies. + +## Usage + +``` +import "github.com/ipfs/go-ipfs-routing" +``` + +Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-routing) + +## Contribute + +PRs accepted. + +Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. + +## License + +MIT © Protocol Labs, Inc. diff --git a/mock/centralized_client.go b/mock/centralized_client.go index 985eb28..f00f11a 100644 --- a/mock/centralized_client.go +++ b/mock/centralized_client.go @@ -5,18 +5,18 @@ import ( "errors" "time" - u "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util" - ds "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore" - logging "gx/ipfs/QmRb5jh8z2E8hMGN2tkvs1yHynUanqnZ3UeKwgN1i9P1F8/go-log" - routing "gx/ipfs/QmTiWLZ6Fo5j4KcTVutZJ5KWRRJrbxzmxA4td8NfEdrPh7/go-libp2p-routing" - dhtpb "gx/ipfs/QmUpttFinNDmNPgFwKN8sZK6BUtBmA68Y4KdSBDXa8t9sJ/go-libp2p-record/pb" - "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil" - ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" - pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore" - proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" - dshelp "gx/ipfs/QmdQTPWduSeyveSxeCAte33M592isSW5Z979g81aJphrgn/go-ipfs-ds-help" + proto "github.com/gogo/protobuf/proto" + cid "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + dshelp "github.com/ipfs/go-ipfs-ds-help" + u "github.com/ipfs/go-ipfs-util" + logging "github.com/ipfs/go-log" + peer "github.com/libp2p/go-libp2p-peer" + pstore "github.com/libp2p/go-libp2p-peerstore" + dhtpb "github.com/libp2p/go-libp2p-record/pb" + routing "github.com/libp2p/go-libp2p-routing" + "github.com/libp2p/go-testutil" + ma "github.com/multiformats/go-multiaddr" ) var log = logging.Logger("mockrouter") diff --git a/mock/centralized_server.go b/mock/centralized_server.go index b4263d1..ab1a985 100644 --- a/mock/centralized_server.go +++ b/mock/centralized_server.go @@ -6,13 +6,12 @@ import ( "sync" "time" - "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil" - - ds "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore" - dssync "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore/sync" - pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + cid "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + dssync "github.com/ipfs/go-datastore/sync" + peer "github.com/libp2p/go-libp2p-peer" + pstore "github.com/libp2p/go-libp2p-peerstore" + "github.com/libp2p/go-testutil" ) // server is the mockrouting.Client's private interface to the routing server diff --git a/mock/centralized_test.go b/mock/centralized_test.go index b3f6c29..704557a 100644 --- a/mock/centralized_test.go +++ b/mock/centralized_test.go @@ -5,11 +5,11 @@ import ( "testing" "time" - u "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util" - delay "gx/ipfs/QmRJVNatYJwTAHgdSM1Xef9QVQ1Ch3XHdmcrykjP5Y4soL/go-ipfs-delay" - testutil "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil" - pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + cid "github.com/ipfs/go-cid" + delay "github.com/ipfs/go-ipfs-delay" + u "github.com/ipfs/go-ipfs-util" + pstore "github.com/libp2p/go-libp2p-peerstore" + testutil "github.com/libp2p/go-testutil" ) func TestKeyNotFound(t *testing.T) { diff --git a/mock/interface.go b/mock/interface.go index a4b1981..c14a776 100644 --- a/mock/interface.go +++ b/mock/interface.go @@ -7,11 +7,11 @@ package mockrouting import ( "context" - ds "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore" - delay "gx/ipfs/QmRJVNatYJwTAHgdSM1Xef9QVQ1Ch3XHdmcrykjP5Y4soL/go-ipfs-delay" - routing "gx/ipfs/QmTiWLZ6Fo5j4KcTVutZJ5KWRRJrbxzmxA4td8NfEdrPh7/go-libp2p-routing" - "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" + ds "github.com/ipfs/go-datastore" + delay "github.com/ipfs/go-ipfs-delay" + peer "github.com/libp2p/go-libp2p-peer" + routing "github.com/libp2p/go-libp2p-routing" + "github.com/libp2p/go-testutil" ) // Server provides mockrouting Clients diff --git a/none/none_client.go b/none/none_client.go index aee2b28..e5d00b0 100644 --- a/none/none_client.go +++ b/none/none_client.go @@ -5,13 +5,12 @@ import ( "context" "errors" + cid "github.com/ipfs/go-cid" repo "github.com/ipfs/go-ipfs/repo" - - p2phost "gx/ipfs/QmNmJZL7FQySMtE2BQuLMuZg2EB2CLEunJJUSVSc9YnnbV/go-libp2p-host" - routing "gx/ipfs/QmTiWLZ6Fo5j4KcTVutZJ5KWRRJrbxzmxA4td8NfEdrPh7/go-libp2p-routing" - pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + p2phost "github.com/libp2p/go-libp2p-host" + peer "github.com/libp2p/go-libp2p-peer" + pstore "github.com/libp2p/go-libp2p-peerstore" + routing "github.com/libp2p/go-libp2p-routing" ) type nilclient struct { diff --git a/offline/offline.go b/offline/offline.go index cc525a0..7384c6d 100644 --- a/offline/offline.go +++ b/offline/offline.go @@ -7,16 +7,16 @@ import ( "errors" "time" - ds "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore" - routing "gx/ipfs/QmTiWLZ6Fo5j4KcTVutZJ5KWRRJrbxzmxA4td8NfEdrPh7/go-libp2p-routing" - record "gx/ipfs/QmUpttFinNDmNPgFwKN8sZK6BUtBmA68Y4KdSBDXa8t9sJ/go-libp2p-record" - pb "gx/ipfs/QmUpttFinNDmNPgFwKN8sZK6BUtBmA68Y4KdSBDXa8t9sJ/go-libp2p-record/pb" - pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore" - proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto" - "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" - ci "gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" - dshelp "gx/ipfs/QmdQTPWduSeyveSxeCAte33M592isSW5Z979g81aJphrgn/go-ipfs-ds-help" + proto "github.com/gogo/protobuf/proto" + cid "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + dshelp "github.com/ipfs/go-ipfs-ds-help" + ci "github.com/libp2p/go-libp2p-crypto" + "github.com/libp2p/go-libp2p-peer" + pstore "github.com/libp2p/go-libp2p-peerstore" + record "github.com/libp2p/go-libp2p-record" + pb "github.com/libp2p/go-libp2p-record/pb" + routing "github.com/libp2p/go-libp2p-routing" ) // ErrOffline is returned when trying to perform operations that diff --git a/offline/offline_test.go b/offline/offline_test.go index 66d8517..a685dca 100644 --- a/offline/offline_test.go +++ b/offline/offline_test.go @@ -5,8 +5,8 @@ import ( "context" "testing" - ds "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore" - "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil" + ds "github.com/ipfs/go-datastore" + "github.com/libp2p/go-testutil" ) func TestOfflineRouterStorage(t *testing.T) { diff --git a/package.json b/package.json new file mode 100644 index 0000000..c8c40cb --- /dev/null +++ b/package.json @@ -0,0 +1,76 @@ +{ + "author": "hsanjuan", + "bugs": { + "url": "https://github.com/ipfs/go-ipfs-routing" + }, + "gx": { + "dvcsimport": "github.com/ipfs/go-ipfs-routing" + }, + "gxDependencies": [ + { + "author": "whyrusleeping", + "hash": "QmNmJZL7FQySMtE2BQuLMuZg2EB2CLEunJJUSVSc9YnnbV", + "name": "go-libp2p-host", + "version": "2.1.5" + }, + { + "hash": "QmTiWLZ6Fo5j4KcTVutZJ5KWRRJrbxzmxA4td8NfEdrPh7", + "name": "go-libp2p-routing", + "version": "2.2.21" + }, + { + "author": "whyrusleeping", + "hash": "QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH", + "name": "go-libp2p-peerstore", + "version": "1.4.15" + }, + { + "author": "whyrusleeping", + "hash": "QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS", + "name": "go-libp2p-peer", + "version": "2.2.3" + }, + { + "author": "whyrusleeping", + "hash": "QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY", + "name": "go-cid", + "version": "0.7.20" + }, + { + "author": "jbenet", + "hash": "QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg", + "name": "go-datastore", + "version": "1.4.1" + }, + { + "author": "hsanjuan", + "hash": "QmRJVNatYJwTAHgdSM1Xef9QVQ1Ch3XHdmcrykjP5Y4soL", + "name": "go-ipfs-delay", + "version": "0.0.1" + }, + { + "author": "whyrusleeping", + "hash": "QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf", + "name": "go-testutil", + "version": "1.1.15" + }, + { + "hash": "QmUpttFinNDmNPgFwKN8sZK6BUtBmA68Y4KdSBDXa8t9sJ", + "name": "go-libp2p-record", + "version": "3.0.2" + }, + { + "author": "hsanjuan", + "hash": "QmdQTPWduSeyveSxeCAte33M592isSW5Z979g81aJphrgn", + "name": "go-ipfs-ds-help", + "version": "0.0.1" + } + ], + "gxVersion": "0.12.1", + "language": "go", + "license": "MIT", + "name": "go-ipfs-routing", + "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", + "version": "0.0.0" +} + -- GitLab