From 0c57bcc180a66ac063120ffc3c55e7598d34a80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 16 Apr 2019 18:10:19 +0100 Subject: [PATCH 1/8] switch to go-libp2p-core. --- deprecated.go | 31 +++++++++ go.mod | 9 +-- go.sum | 14 ++-- notifications/deprecated.go | 39 ++++++++++++ notifications/query.go | 121 ----------------------------------- notifications/query_test.go | 44 ------------- options/deprecated.go | 15 +++++ options/options.go | 50 --------------- routing.go | 124 ------------------------------------ 9 files changed, 97 insertions(+), 350 deletions(-) create mode 100644 deprecated.go create mode 100644 notifications/deprecated.go delete mode 100644 notifications/query.go delete mode 100644 notifications/query_test.go create mode 100644 options/deprecated.go delete mode 100644 options/options.go delete mode 100644 routing.go diff --git a/deprecated.go b/deprecated.go new file mode 100644 index 0000000..662fe68 --- /dev/null +++ b/deprecated.go @@ -0,0 +1,31 @@ +// package routing defines the interface for a routing system used by ipfs. +package routing + +import moved "github.com/libp2p/go-libp2p-core/routing" + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.ErrNotFound instead. +var ErrNotFound = moved.ErrNotFound + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.ErrNotSupported instead. +var ErrNotSupported = moved.ErrNotSupported + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.ContentRouting instead. +type ContentRouting = moved.ContentRouting + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.PeerRouting instead. +type PeerRouting = moved.PeerRouting + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.ValueStore instead. +type ValueStore = moved.ValueStore + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.Routing instead. +type IpfsRouting = moved.Routing + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.PubKeyFetcher instead. +type PubKeyFetcher = moved.PubKeyFetcher + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.KeyForPublicKey instead. +var KeyForPublicKey = moved.KeyForPublicKey + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.GetPublicKey instead. +var GetPublicKey = moved.GetPublicKey diff --git a/go.mod b/go.mod index e661bca..96a6e5b 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,5 @@ module github.com/libp2p/go-libp2p-routing -require ( - github.com/ipfs/go-cid v0.0.1 - github.com/libp2p/go-libp2p-crypto v0.0.1 - github.com/libp2p/go-libp2p-peer v0.0.1 - github.com/libp2p/go-libp2p-peerstore v0.0.1 -) +go 1.12 + +require github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da diff --git a/go.sum b/go.sum index 4105d68..069482b 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,7 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -47,24 +48,27 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= +github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da h1:zkOK0lDgEDQbkX+R5n3RGtRQQs3Ldh+FH0TEEg8S3P0= +github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da/go.mod h1:5WmdfBZgh0OiotzGCDVDutKBwXGIf3rRDtxbNF33WYo= github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= +github.com/libp2p/go-libp2p-peer v0.1.0/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= +github.com/libp2p/go-libp2p-peerstore v0.0.2/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= 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/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= +github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -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 v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= +github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= diff --git a/notifications/deprecated.go b/notifications/deprecated.go new file mode 100644 index 0000000..a7ccc35 --- /dev/null +++ b/notifications/deprecated.go @@ -0,0 +1,39 @@ +package notifications + +import moved "github.com/libp2p/go-libp2p-core/routing/notifications" + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventType instead. +type QueryEventType = moved.QueryEventType + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventBufferSize instead. +// Warning: it's impossible to alias a var in go, so reads and writes to this variable may be inaccurate +// or not have the intended effect. +var QueryEventBufferSize = moved.QueryEventBufferSize + +const ( + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.SendingQuery instead. + SendingQuery = moved.SendingQuery + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PeerResponse instead. + PeerResponse = moved.PeerResponse + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.FinalPeer instead. + FinalPeer = moved.FinalPeer + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryError instead. + QueryError = moved.QueryError + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.Provider instead. + Provider = moved.Provider + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.Value instead. + Value = moved.Value + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.AddingPeer instead. + AddingPeer = moved.AddingPeer + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.DialingPeer instead. + DialingPeer = moved.DialingPeer +) + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEvent instead. +type QueryEvent = moved.QueryEvent + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.RegisterForQueryEvents instead. +var RegisterForQueryEvents = moved.RegisterForQueryEvents + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PublishQueryEvent instead. +var PublishQueryEvent = moved.PublishQueryEvent diff --git a/notifications/query.go b/notifications/query.go deleted file mode 100644 index 84eba85..0000000 --- a/notifications/query.go +++ /dev/null @@ -1,121 +0,0 @@ -package notifications - -import ( - "context" - "encoding/json" - "sync" - - peer "github.com/libp2p/go-libp2p-peer" - pstore "github.com/libp2p/go-libp2p-peerstore" -) - -type QueryEventType int - -// Number of events to buffer. -var QueryEventBufferSize = 16 - -const ( - SendingQuery QueryEventType = iota - PeerResponse - FinalPeer - QueryError - Provider - Value - AddingPeer - DialingPeer -) - -type QueryEvent struct { - ID peer.ID - Type QueryEventType - Responses []*pstore.PeerInfo - Extra string -} - -type routingQueryKey struct{} -type eventChannel struct { - mu sync.Mutex - ctx context.Context - ch chan<- *QueryEvent -} - -// waitThenClose is spawned in a goroutine when the channel is registered. This -// safely cleans up the channel when the context has been canceled. -func (e *eventChannel) waitThenClose() { - <-e.ctx.Done() - e.mu.Lock() - close(e.ch) - // 1. Signals that we're done. - // 2. Frees memory (in case we end up hanging on to this for a while). - e.ch = nil - e.mu.Unlock() -} - -// send sends an event on the event channel, aborting if either the passed or -// the internal context expire. -func (e *eventChannel) send(ctx context.Context, ev *QueryEvent) { - e.mu.Lock() - // Closed. - if e.ch == nil { - e.mu.Unlock() - return - } - // in case the passed context is unrelated, wait on both. - select { - case e.ch <- ev: - case <-e.ctx.Done(): - case <-ctx.Done(): - } - e.mu.Unlock() -} - -func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *QueryEvent) { - ch := make(chan *QueryEvent, QueryEventBufferSize) - ech := &eventChannel{ch: ch, ctx: ctx} - go ech.waitThenClose() - return context.WithValue(ctx, routingQueryKey{}, ech), ch -} - -func PublishQueryEvent(ctx context.Context, ev *QueryEvent) { - ich := ctx.Value(routingQueryKey{}) - if ich == nil { - return - } - - // We *want* to panic here. - ech := ich.(*eventChannel) - ech.send(ctx, ev) -} - -func (qe *QueryEvent) MarshalJSON() ([]byte, error) { - return json.Marshal(map[string]interface{}{ - "ID": peer.IDB58Encode(qe.ID), - "Type": int(qe.Type), - "Responses": qe.Responses, - "Extra": qe.Extra, - }) -} - -func (qe *QueryEvent) UnmarshalJSON(b []byte) error { - temp := struct { - ID string - Type int - Responses []*pstore.PeerInfo - Extra string - }{} - err := json.Unmarshal(b, &temp) - if err != nil { - return err - } - if len(temp.ID) > 0 { - pid, err := peer.IDB58Decode(temp.ID) - if err != nil { - return err - } - qe.ID = pid - } - qe.Type = QueryEventType(temp.Type) - qe.Responses = temp.Responses - qe.Extra = temp.Extra - return nil -} diff --git a/notifications/query_test.go b/notifications/query_test.go deleted file mode 100644 index 98c2c0e..0000000 --- a/notifications/query_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package notifications - -import ( - "context" - "fmt" - "sync" - "testing" -) - -func TestEventsCancel(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - ctx, events := RegisterForQueryEvents(ctx) - goch := make(chan struct{}) - var wg sync.WaitGroup - wg.Add(2) - go func() { - defer wg.Done() - for i := 0; i < 100; i++ { - PublishQueryEvent(ctx, &QueryEvent{Extra: fmt.Sprint(i)}) - } - close(goch) - for i := 100; i < 1000; i++ { - PublishQueryEvent(ctx, &QueryEvent{Extra: fmt.Sprint(i)}) - } - }() - go func() { - defer wg.Done() - i := 0 - for e := range events { - if i < 100 { - if e.Extra != fmt.Sprint(i) { - t.Errorf("expected %d, got %s", i, e.Extra) - } - } - i++ - } - if i < 100 { - t.Errorf("expected at least 100 events, got %d", i) - } - }() - <-goch - cancel() - wg.Wait() -} diff --git a/options/deprecated.go b/options/deprecated.go new file mode 100644 index 0000000..27fd8ca --- /dev/null +++ b/options/deprecated.go @@ -0,0 +1,15 @@ +package ropts + +import moved "github.com/libp2p/go-libp2p-core/routing/options" + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Option instead. +type Option = moved.Option + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Options instead. +type Options = moved.Options + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Expired instead. +var Expired = moved.Expired + +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Offline instead. +var Offline = moved.Offline diff --git a/options/options.go b/options/options.go deleted file mode 100644 index e0c9a52..0000000 --- a/options/options.go +++ /dev/null @@ -1,50 +0,0 @@ -package ropts - -// Option is a single routing option. -type Option func(opts *Options) error - -// Options is a set of routing options -type Options struct { - // Allow expired values. - Expired bool - Offline bool - // Other (ValueStore implementation specific) options. - Other map[interface{}]interface{} -} - -// Apply applies the given options to this Options -func (opts *Options) Apply(options ...Option) error { - for _, o := range options { - if err := o(opts); err != nil { - return err - } - } - return nil -} - -// ToOption converts this Options to a single Option. -func (opts *Options) ToOption() Option { - return func(nopts *Options) error { - *nopts = *opts - if opts.Other != nil { - nopts.Other = make(map[interface{}]interface{}, len(opts.Other)) - for k, v := range opts.Other { - nopts.Other[k] = v - } - } - return nil - } -} - -// Expired is an option that tells the routing system to return expired records -// when no newer records are known. -var Expired Option = func(opts *Options) error { - opts.Expired = true - return nil -} - -// Offline is an option that tells the routing system to operate offline (i.e., rely on cached/local data only). -var Offline Option = func(opts *Options) error { - opts.Offline = true - return nil -} diff --git a/routing.go b/routing.go deleted file mode 100644 index 5fc1e9f..0000000 --- a/routing.go +++ /dev/null @@ -1,124 +0,0 @@ -// package routing defines the interface for a routing system used by ipfs. -package routing - -import ( - "context" - "errors" - - ropts "github.com/libp2p/go-libp2p-routing/options" - - cid "github.com/ipfs/go-cid" - ci "github.com/libp2p/go-libp2p-crypto" - peer "github.com/libp2p/go-libp2p-peer" - pstore "github.com/libp2p/go-libp2p-peerstore" -) - -// ErrNotFound is returned when the router fails to find the requested record. -var ErrNotFound = errors.New("routing: not found") - -// ErrNotSupported is returned when the router doesn't support the given record -// type/operation. -var ErrNotSupported = errors.New("routing: operation or key not supported") - -// ContentRouting is a value provider layer of indirection. It is used to find -// information about who has what content. -type ContentRouting interface { - // Provide adds the given cid to the content routing system. If 'true' is - // passed, it also announces it, otherwise it is just kept in the local - // accounting of which objects are being provided. - Provide(context.Context, cid.Cid, bool) error - - // Search for peers who are able to provide a given key - FindProvidersAsync(context.Context, cid.Cid, int) <-chan pstore.PeerInfo -} - -// PeerRouting is a way to find information about certain peers. -// This can be implemented by a simple lookup table, a tracking server, -// or even a DHT. -type PeerRouting interface { - // Find specific Peer - // FindPeer searches for a peer with given ID, returns a pstore.PeerInfo - // with relevant addresses. - FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error) -} - -// ValueStore is a basic Put/Get interface. -type ValueStore interface { - - // PutValue adds value corresponding to given Key. - PutValue(context.Context, string, []byte, ...ropts.Option) error - - // GetValue searches for the value corresponding to given Key. - GetValue(context.Context, string, ...ropts.Option) ([]byte, error) - - // SearchValue searches for better and better values from this value - // store corresponding to the given Key. By default implementations must - // stop the search after a good value is found. A 'good' value is a value - // that would be returned from GetValue. - // - // Useful when you want a result *now* but still want to hear about - // better/newer results. - // - // Implementations of this methods won't return ErrNotFound. When a value - // couldn't be found, the channel will get closed without passing any results - SearchValue(context.Context, string, ...ropts.Option) (<-chan []byte, error) -} - -// IpfsRouting is the combination of different routing types that IPFS uses. -// It can be satisfied by a single item (such as a DHT) or multiple different -// pieces that are more optimized to each task. -type IpfsRouting interface { - ContentRouting - PeerRouting - ValueStore - - // Bootstrap allows callers to hint to the routing system to get into a - // Boostrapped state and remain there. It is not a synchronous call. - Bootstrap(context.Context) error - - // TODO expose io.Closer or plain-old Close error -} - -// PubKeyFetcher is an interfaces that should be implemented by value stores -// that can optimize retrieval of public keys. -// -// TODO(steb): Consider removing, see #22. -type PubKeyFetcher interface { - // GetPublicKey returns the public key for the given peer. - GetPublicKey(context.Context, peer.ID) (ci.PubKey, error) -} - -// KeyForPublicKey returns the key used to retrieve public keys -// from a value store. -func KeyForPublicKey(id peer.ID) string { - return "/pk/" + string(id) -} - -// GetPublicKey retrieves the public key associated with the given peer ID from -// the value store. -// -// If the ValueStore is also a PubKeyFetcher, this method will call GetPublicKey -// (which may be better optimized) instead of GetValue. -func GetPublicKey(r ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error) { - switch k, err := p.ExtractPublicKey(); err { - case peer.ErrNoPublicKey: - // check the datastore - case nil: - return k, nil - default: - return nil, err - } - - if dht, ok := r.(PubKeyFetcher); ok { - // If we have a DHT as our routing system, use optimized fetcher - return dht.GetPublicKey(ctx, p) - } - key := KeyForPublicKey(p) - pkval, err := r.GetValue(ctx, key) - if err != nil { - return nil, err - } - - // get PublicKey from node.Data - return ci.UnmarshalPublicKey(pkval) -} From ba33b57dda4bf11d05fa4f41657500609f4e04d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 16 Apr 2019 18:32:01 +0100 Subject: [PATCH 2/8] downgrade to go 1.11 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 96a6e5b..3f02427 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/libp2p/go-libp2p-routing -go 1.12 +go 1.11 require github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da From fa836dcbb305ebc620e955c73337627a056bcfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 16 Apr 2019 22:03:06 +0100 Subject: [PATCH 3/8] remove go 1.11 directive from go.mod. --- go.mod | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.mod b/go.mod index 3f02427..92c36c1 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,3 @@ module github.com/libp2p/go-libp2p-routing -go 1.11 - require github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da From cc6cca50fb26c86adc5d1883488c756f3459f2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 17 Apr 2019 15:44:44 +0100 Subject: [PATCH 4/8] alias deprecated funcs by proxying calls. --- deprecated.go | 16 +++++++++++--- go.mod | 5 ++++- go.sum | 42 +++---------------------------------- notifications/deprecated.go | 14 ++++++++++--- 4 files changed, 31 insertions(+), 46 deletions(-) diff --git a/deprecated.go b/deprecated.go index 662fe68..4ba14e9 100644 --- a/deprecated.go +++ b/deprecated.go @@ -1,7 +1,13 @@ // package routing defines the interface for a routing system used by ipfs. package routing -import moved "github.com/libp2p/go-libp2p-core/routing" +import ( + "context" + + "github.com/libp2p/go-libp2p-core/peer" + moved "github.com/libp2p/go-libp2p-core/routing" + ci "github.com/libp2p/go-libp2p-crypto" +) // Deprecated: use github.com/libp2p/go-libp2p-core/routing.ErrNotFound instead. var ErrNotFound = moved.ErrNotFound @@ -25,7 +31,11 @@ type IpfsRouting = moved.Routing type PubKeyFetcher = moved.PubKeyFetcher // Deprecated: use github.com/libp2p/go-libp2p-core/routing.KeyForPublicKey instead. -var KeyForPublicKey = moved.KeyForPublicKey +func KeyForPublicKey(id peer.ID) string { + return moved.KeyForPublicKey(id) +} // Deprecated: use github.com/libp2p/go-libp2p-core/routing.GetPublicKey instead. -var GetPublicKey = moved.GetPublicKey +func GetPublicKey(r moved.ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error) { + return moved.GetPublicKey(r, ctx, p) +} diff --git a/go.mod b/go.mod index 92c36c1..e206980 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,6 @@ module github.com/libp2p/go-libp2p-routing -require github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da +require ( + github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8 + github.com/libp2p/go-libp2p-crypto v0.0.1 +) diff --git a/go.sum b/go.sum index 069482b..7640f58 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -11,33 +9,19 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= @@ -47,16 +31,10 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da h1:zkOK0lDgEDQbkX+R5n3RGtRQQs3Ldh+FH0TEEg8S3P0= -github.com/libp2p/go-libp2p-core v0.0.0-20190416150442-54a1b70f07da/go.mod h1:5WmdfBZgh0OiotzGCDVDutKBwXGIf3rRDtxbNF33WYo= +github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8 h1:JhVz9FMZJ2iUZ0O2rxgfpgf6Pbf4ngi+gpkjT9hi/R8= +github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8/go.mod h1:4iqSipG3tx8vB0FVHHRPVl6/lZqPht2Lhd/ZBlIGNSo= github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peer v0.1.0/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peerstore v0.0.2/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= @@ -66,11 +44,8 @@ github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= @@ -78,21 +53,11 @@ github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKT github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -100,7 +65,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpbl golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= diff --git a/notifications/deprecated.go b/notifications/deprecated.go index a7ccc35..061dc7f 100644 --- a/notifications/deprecated.go +++ b/notifications/deprecated.go @@ -1,6 +1,10 @@ package notifications -import moved "github.com/libp2p/go-libp2p-core/routing/notifications" +import ( + "context" + + moved "github.com/libp2p/go-libp2p-core/routing/notifications" +) // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventType instead. type QueryEventType = moved.QueryEventType @@ -33,7 +37,11 @@ const ( type QueryEvent = moved.QueryEvent // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.RegisterForQueryEvents instead. -var RegisterForQueryEvents = moved.RegisterForQueryEvents +func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *moved.QueryEvent) { + return moved.RegisterForQueryEvents(ctx) +} // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PublishQueryEvent instead. -var PublishQueryEvent = moved.PublishQueryEvent +func PublishQueryEvent(ctx context.Context, ev *moved.QueryEvent) { + moved.PublishQueryEvent(ctx, ev) +} From 34dba273071dad3498b6951a4e38fde0e7a2067e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 17 Apr 2019 17:35:50 +0100 Subject: [PATCH 5/8] upgrade deps. --- go.mod | 2 +- go.sum | 4 ++-- notifications/deprecated.go | 2 +- options/deprecated.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index e206980..e8ab38d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/libp2p/go-libp2p-routing require ( - github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8 + github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b github.com/libp2p/go-libp2p-crypto v0.0.1 ) diff --git a/go.sum b/go.sum index 7640f58..84d9bd5 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8 h1:JhVz9FMZJ2iUZ0O2rxgfpgf6Pbf4ngi+gpkjT9hi/R8= -github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8/go.mod h1:4iqSipG3tx8vB0FVHHRPVl6/lZqPht2Lhd/ZBlIGNSo= +github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b h1:G7jk8dtQP5NeK5uckxMarWHNH0bTTDpSUMPUQwGtFEU= +github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b/go.mod h1:4iqSipG3tx8vB0FVHHRPVl6/lZqPht2Lhd/ZBlIGNSo= github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= diff --git a/notifications/deprecated.go b/notifications/deprecated.go index 061dc7f..fff8c7a 100644 --- a/notifications/deprecated.go +++ b/notifications/deprecated.go @@ -3,7 +3,7 @@ package notifications import ( "context" - moved "github.com/libp2p/go-libp2p-core/routing/notifications" + moved "github.com/libp2p/go-libp2p-core/routing" ) // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventType instead. diff --git a/options/deprecated.go b/options/deprecated.go index 27fd8ca..64931d0 100644 --- a/options/deprecated.go +++ b/options/deprecated.go @@ -1,6 +1,6 @@ package ropts -import moved "github.com/libp2p/go-libp2p-core/routing/options" +import moved "github.com/libp2p/go-libp2p-core/routing" // Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Option instead. type Option = moved.Option From a5c31aced3156471e08779936c9a301815e81875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 22 Apr 2019 14:17:29 +0100 Subject: [PATCH 6/8] rename moved pkg alias to core; upgrade deps. --- deprecated.go | 22 +++++++++++----------- go.mod | 4 ++-- go.sum | 9 +++++---- notifications/deprecated.go | 32 ++++++++++++++++---------------- options/deprecated.go | 10 +++++----- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/deprecated.go b/deprecated.go index 4ba14e9..1918e55 100644 --- a/deprecated.go +++ b/deprecated.go @@ -5,37 +5,37 @@ import ( "context" "github.com/libp2p/go-libp2p-core/peer" - moved "github.com/libp2p/go-libp2p-core/routing" + core "github.com/libp2p/go-libp2p-core/routing" ci "github.com/libp2p/go-libp2p-crypto" ) // Deprecated: use github.com/libp2p/go-libp2p-core/routing.ErrNotFound instead. -var ErrNotFound = moved.ErrNotFound +var ErrNotFound = core.ErrNotFound // Deprecated: use github.com/libp2p/go-libp2p-core/routing.ErrNotSupported instead. -var ErrNotSupported = moved.ErrNotSupported +var ErrNotSupported = core.ErrNotSupported // Deprecated: use github.com/libp2p/go-libp2p-core/routing.ContentRouting instead. -type ContentRouting = moved.ContentRouting +type ContentRouting = core.ContentRouting // Deprecated: use github.com/libp2p/go-libp2p-core/routing.PeerRouting instead. -type PeerRouting = moved.PeerRouting +type PeerRouting = core.PeerRouting // Deprecated: use github.com/libp2p/go-libp2p-core/routing.ValueStore instead. -type ValueStore = moved.ValueStore +type ValueStore = core.ValueStore // Deprecated: use github.com/libp2p/go-libp2p-core/routing.Routing instead. -type IpfsRouting = moved.Routing +type IpfsRouting = core.Routing // Deprecated: use github.com/libp2p/go-libp2p-core/routing.PubKeyFetcher instead. -type PubKeyFetcher = moved.PubKeyFetcher +type PubKeyFetcher = core.PubKeyFetcher // Deprecated: use github.com/libp2p/go-libp2p-core/routing.KeyForPublicKey instead. func KeyForPublicKey(id peer.ID) string { - return moved.KeyForPublicKey(id) + return core.KeyForPublicKey(id) } // Deprecated: use github.com/libp2p/go-libp2p-core/routing.GetPublicKey instead. -func GetPublicKey(r moved.ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error) { - return moved.GetPublicKey(r, ctx, p) +func GetPublicKey(r core.ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error) { + return core.GetPublicKey(r, ctx, p) } diff --git a/go.mod b/go.mod index e8ab38d..82ead3c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/libp2p/go-libp2p-routing require ( - github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b - github.com/libp2p/go-libp2p-crypto v0.0.1 + github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178 + github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de ) diff --git a/go.sum b/go.sum index 84d9bd5..5b1058c 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,7 @@ github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmv github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= @@ -31,10 +32,10 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b h1:G7jk8dtQP5NeK5uckxMarWHNH0bTTDpSUMPUQwGtFEU= -github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b/go.mod h1:4iqSipG3tx8vB0FVHHRPVl6/lZqPht2Lhd/ZBlIGNSo= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= +github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178 h1:+wsyafI3SBZy7fMT8bTdHyrzKnPJfDShnbfjxXM3uqk= +github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178/go.mod h1:GYAqGjbAd2HxtkR5D6HsOp1ZPBrGvCD0eCLX8rQtNMw= +github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de h1:yM+S5llDeinUQnBTTQHVvum5iBtLHFCUIPGfDQCYC9Y= +github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de/go.mod h1:WJ6wEfm4tBdTVrgE7Mle69TjHcAxZArSmhNasnU5HXg= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= diff --git a/notifications/deprecated.go b/notifications/deprecated.go index fff8c7a..41bbbf7 100644 --- a/notifications/deprecated.go +++ b/notifications/deprecated.go @@ -3,45 +3,45 @@ package notifications import ( "context" - moved "github.com/libp2p/go-libp2p-core/routing" + core "github.com/libp2p/go-libp2p-core/routing" ) // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventType instead. -type QueryEventType = moved.QueryEventType +type QueryEventType = core.QueryEventType // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventBufferSize instead. // Warning: it's impossible to alias a var in go, so reads and writes to this variable may be inaccurate // or not have the intended effect. -var QueryEventBufferSize = moved.QueryEventBufferSize +var QueryEventBufferSize = core.QueryEventBufferSize const ( // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.SendingQuery instead. - SendingQuery = moved.SendingQuery + SendingQuery = core.SendingQuery // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PeerResponse instead. - PeerResponse = moved.PeerResponse + PeerResponse = core.PeerResponse // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.FinalPeer instead. - FinalPeer = moved.FinalPeer + FinalPeer = core.FinalPeer // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryError instead. - QueryError = moved.QueryError + QueryError = core.QueryError // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.Provider instead. - Provider = moved.Provider + Provider = core.Provider // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.Value instead. - Value = moved.Value + Value = core.Value // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.AddingPeer instead. - AddingPeer = moved.AddingPeer + AddingPeer = core.AddingPeer // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.DialingPeer instead. - DialingPeer = moved.DialingPeer + DialingPeer = core.DialingPeer ) // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEvent instead. -type QueryEvent = moved.QueryEvent +type QueryEvent = core.QueryEvent // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.RegisterForQueryEvents instead. -func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *moved.QueryEvent) { - return moved.RegisterForQueryEvents(ctx) +func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *core.QueryEvent) { + return core.RegisterForQueryEvents(ctx) } // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PublishQueryEvent instead. -func PublishQueryEvent(ctx context.Context, ev *moved.QueryEvent) { - moved.PublishQueryEvent(ctx, ev) +func PublishQueryEvent(ctx context.Context, ev *core.QueryEvent) { + core.PublishQueryEvent(ctx, ev) } diff --git a/options/deprecated.go b/options/deprecated.go index 64931d0..a8a5573 100644 --- a/options/deprecated.go +++ b/options/deprecated.go @@ -1,15 +1,15 @@ package ropts -import moved "github.com/libp2p/go-libp2p-core/routing" +import core "github.com/libp2p/go-libp2p-core/routing" // Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Option instead. -type Option = moved.Option +type Option = core.Option // Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Options instead. -type Options = moved.Options +type Options = core.Options // Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Expired instead. -var Expired = moved.Expired +var Expired = core.Expired // Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Offline instead. -var Offline = moved.Offline +var Offline = core.Offline From eaba2d79950d16a8e2258dc95d223d93af3ce4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 8 May 2019 16:11:54 +0100 Subject: [PATCH 7/8] refactor test utilities, harnesses and suites. --- go.mod | 3 ++- go.sum | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 82ead3c..12a5159 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module github.com/libp2p/go-libp2p-routing require ( - github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178 + github.com/libp2p/go-libp2p-core v0.0.0-20190508144953-ed42958fbb3a github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de + golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect ) diff --git a/go.sum b/go.sum index 5b1058c..a223aae 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,10 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178 h1:+wsyafI3SBZy7fMT8bTdHyrzKnPJfDShnbfjxXM3uqk= +github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178/go.mod h1:GYAqGjbAd2HxtkR5D6HsOp1ZPBrGvCD0eCLX8rQtNMw= +github.com/libp2p/go-libp2p-core v0.0.0-20190508144953-ed42958fbb3a h1:2COA6CKf0U0TuI8k+qSrlk3wb974etkxsTgjFDGUADw= +github.com/libp2p/go-libp2p-core v0.0.0-20190508144953-ed42958fbb3a/go.mod h1:U1aaQsPt97g1BVcfdLEnzHdSNbaSg3Gh5eKgJ/KunKg= github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de h1:yM+S5llDeinUQnBTTQHVvum5iBtLHFCUIPGfDQCYC9Y= github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de/go.mod h1:WJ6wEfm4tBdTVrgE7Mle69TjHcAxZArSmhNasnU5HXg= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= @@ -61,6 +63,7 @@ golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnf golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From 838282bd637dbc4ec8a760e2fc27c839c6a2ac08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Sat, 25 May 2019 12:07:02 +0100 Subject: [PATCH 8/8] upgrade deps; comments. --- deprecated.go | 5 +++-- go.mod | 3 +-- go.sum | 15 ++++++--------- notifications/deprecated.go | 27 ++++++++++++++------------- options/deprecated.go | 9 +++++---- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/deprecated.go b/deprecated.go index 1918e55..ab7616e 100644 --- a/deprecated.go +++ b/deprecated.go @@ -1,12 +1,13 @@ -// package routing defines the interface for a routing system used by ipfs. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing instead. package routing import ( "context" + ci "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/peer" + core "github.com/libp2p/go-libp2p-core/routing" - ci "github.com/libp2p/go-libp2p-crypto" ) // Deprecated: use github.com/libp2p/go-libp2p-core/routing.ErrNotFound instead. diff --git a/go.mod b/go.mod index 12a5159..dcbc333 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,6 @@ module github.com/libp2p/go-libp2p-routing require ( - github.com/libp2p/go-libp2p-core v0.0.0-20190508144953-ed42958fbb3a - github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de + github.com/libp2p/go-libp2p-core v0.0.1 golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect ) diff --git a/go.sum b/go.sum index a223aae..4108f01 100644 --- a/go.sum +++ b/go.sum @@ -29,15 +29,9 @@ github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlT github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178/go.mod h1:GYAqGjbAd2HxtkR5D6HsOp1ZPBrGvCD0eCLX8rQtNMw= -github.com/libp2p/go-libp2p-core v0.0.0-20190508144953-ed42958fbb3a h1:2COA6CKf0U0TuI8k+qSrlk3wb974etkxsTgjFDGUADw= -github.com/libp2p/go-libp2p-core v0.0.0-20190508144953-ed42958fbb3a/go.mod h1:U1aaQsPt97g1BVcfdLEnzHdSNbaSg3Gh5eKgJ/KunKg= -github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de h1:yM+S5llDeinUQnBTTQHVvum5iBtLHFCUIPGfDQCYC9Y= -github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de/go.mod h1:WJ6wEfm4tBdTVrgE7Mle69TjHcAxZArSmhNasnU5HXg= +github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= +github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= @@ -56,6 +50,10 @@ github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKT github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= @@ -70,7 +68,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/notifications/deprecated.go b/notifications/deprecated.go index 41bbbf7..29e9e92 100644 --- a/notifications/deprecated.go +++ b/notifications/deprecated.go @@ -1,3 +1,4 @@ +// Deprecated: use github.com/libp2p/go-libp2p-core/routing instead. package notifications import ( @@ -6,42 +7,42 @@ import ( core "github.com/libp2p/go-libp2p-core/routing" ) -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventType instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryEventType instead. type QueryEventType = core.QueryEventType -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEventBufferSize instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryEventBufferSize instead. // Warning: it's impossible to alias a var in go, so reads and writes to this variable may be inaccurate // or not have the intended effect. var QueryEventBufferSize = core.QueryEventBufferSize const ( - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.SendingQuery instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/SendingQuery instead. SendingQuery = core.SendingQuery - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PeerResponse instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/PeerResponse instead. PeerResponse = core.PeerResponse - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.FinalPeer instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/FinalPeer instead. FinalPeer = core.FinalPeer - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryError instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryError instead. QueryError = core.QueryError - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.Provider instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/Provider instead. Provider = core.Provider - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.Value instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/Value instead. Value = core.Value - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.AddingPeer instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/AddingPeer instead. AddingPeer = core.AddingPeer - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.DialingPeer instead. + // Deprecated: use github.com/libp2p/go-libp2p-core/routing/DialingPeer instead. DialingPeer = core.DialingPeer ) -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.QueryEvent instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryEvent instead. type QueryEvent = core.QueryEvent -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.RegisterForQueryEvents instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/RegisterForQueryEvents instead. func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *core.QueryEvent) { return core.RegisterForQueryEvents(ctx) } -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/notifications.PublishQueryEvent instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/PublishQueryEvent instead. func PublishQueryEvent(ctx context.Context, ev *core.QueryEvent) { core.PublishQueryEvent(ctx, ev) } diff --git a/options/deprecated.go b/options/deprecated.go index a8a5573..46c36d7 100644 --- a/options/deprecated.go +++ b/options/deprecated.go @@ -1,15 +1,16 @@ +// Deprecated: use github.com/libp2p/go-libp2p-core/routing instead. package ropts import core "github.com/libp2p/go-libp2p-core/routing" -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Option instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/Option instead. type Option = core.Option -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Options instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/Options instead. type Options = core.Options -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Expired instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing.Expired instead. var Expired = core.Expired -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/options.Offline instead. +// Deprecated: use github.com/libp2p/go-libp2p-core/routing/Offline instead. var Offline = core.Offline