Fix dependencies

This commit is contained in:
George Antoniadis 2016-09-02 20:21:23 +01:00
parent 3256cdc92f
commit 30d43d22e0
17 changed files with 159 additions and 163 deletions

17
dht.go
View File

@ -9,23 +9,22 @@ import (
"sync" "sync"
"time" "time"
key "github.com/ipfs/go-ipfs/blocks/key"
routing "github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
providers "github.com/ipfs/go-ipfs/routing/dht/providers"
kb "github.com/ipfs/go-ipfs/routing/kbucket"
record "github.com/ipfs/go-ipfs/routing/record"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
key "github.com/ipfs/go-key"
ci "github.com/ipfs/go-libp2p-crypto" ci "github.com/ipfs/go-libp2p-crypto"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
host "github.com/ipfs/go-libp2p/p2p/host"
protocol "github.com/ipfs/go-libp2p/p2p/protocol"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
goprocess "github.com/jbenet/goprocess" goprocess "github.com/jbenet/goprocess"
goprocessctx "github.com/jbenet/goprocess/context" goprocessctx "github.com/jbenet/goprocess/context"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
providers "github.com/libp2p/go-libp2p-kad-dht/providers"
kb "github.com/libp2p/go-libp2p-kbucket"
record "github.com/libp2p/go-libp2p-record"
routing "github.com/libp2p/go-libp2p-routing"
host "github.com/libp2p/go-libp2p/p2p/host"
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -9,11 +9,10 @@ import (
"time" "time"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
routing "github.com/ipfs/go-ipfs/routing"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
goprocess "github.com/jbenet/goprocess" goprocess "github.com/jbenet/goprocess"
periodicproc "github.com/jbenet/goprocess/periodic" periodicproc "github.com/jbenet/goprocess/periodic"
routing "github.com/libp2p/go-libp2p-routing"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -6,10 +6,10 @@ import (
"time" "time"
ggio "github.com/gogo/protobuf/io" ggio "github.com/gogo/protobuf/io"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
inet "github.com/ipfs/go-libp2p/p2p/net"
ctxio "github.com/jbenet/go-context/io" ctxio "github.com/jbenet/go-context/io"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -11,17 +11,16 @@ import (
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync" dssync "github.com/ipfs/go-datastore/sync"
key "github.com/ipfs/go-ipfs/blocks/key"
routing "github.com/ipfs/go-ipfs/routing"
record "github.com/ipfs/go-ipfs/routing/record"
ci "github.com/ipfs/go-ipfs/thirdparty/testutil/ci"
travisci "github.com/ipfs/go-ipfs/thirdparty/testutil/ci/travis"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
key "github.com/ipfs/go-key"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
netutil "github.com/ipfs/go-libp2p/p2p/test/util"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
record "github.com/libp2p/go-libp2p-record"
routing "github.com/libp2p/go-libp2p-routing"
netutil "github.com/libp2p/go-libp2p/p2p/test/util"
ci "github.com/libp2p/go-testutil/ci"
travisci "github.com/libp2p/go-testutil/ci/travis"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -6,18 +6,17 @@ import (
"testing" "testing"
"time" "time"
ggio "github.com/gogo/protobuf/io"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync" dssync "github.com/ipfs/go-datastore/sync"
key "github.com/ipfs/go-ipfs/blocks/key"
routing "github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
record "github.com/ipfs/go-ipfs/routing/record"
ggio "github.com/gogo/protobuf/io"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
key "github.com/ipfs/go-key"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
inet "github.com/ipfs/go-libp2p/p2p/net" pb "github.com/libp2p/go-libp2p-kad-dht/pb"
mocknet "github.com/ipfs/go-libp2p/p2p/net/mock" record "github.com/libp2p/go-libp2p-record"
routing "github.com/libp2p/go-libp2p-routing"
inet "github.com/libp2p/go-libp2p/p2p/net"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -5,15 +5,14 @@ import (
"fmt" "fmt"
"time" "time"
ds "github.com/ipfs/go-datastore"
key "github.com/ipfs/go-ipfs/blocks/key"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
lgbl "github.com/ipfs/go-ipfs/thirdparty/loggables"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
ds "github.com/ipfs/go-datastore"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
key "github.com/ipfs/go-key"
lgbl "github.com/ipfs/go-libp2p-loggables"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -1,13 +1,12 @@
package dht package dht
import ( import (
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-key"
notif "github.com/ipfs/go-ipfs/notifications"
kb "github.com/ipfs/go-ipfs/routing/kbucket"
pset "github.com/ipfs/go-ipfs/thirdparty/peerset"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pset "github.com/ipfs/go-libp2p-peer/peerset"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
kb "github.com/libp2p/go-libp2p-kbucket"
notif "github.com/libp2p/go-libp2p-routing/notifications"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -2,8 +2,7 @@ package dht
import ( import (
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
inet "github.com/libp2p/go-libp2p/p2p/net"
inet "github.com/ipfs/go-libp2p/p2p/net"
) )
// netNotifiee defines methods to be used with the IpfsDHT // netNotifiee defines methods to be used with the IpfsDHT

View File

@ -25,9 +25,9 @@
}, },
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
"hash": "QmRBqJF7hb8ZSpRcMwUt8hNhydWcxGEhtk81HKq6oUwKvs", "hash": "QmWXjJo15p4pzT7cayEwZi2sWgJqLnGDof6ZGMh9xBgU1p",
"name": "go-libp2p-peer", "name": "go-libp2p-peer",
"version": "1.0.8" "version": "2.0.4"
}, },
{ {
"hash": "QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt", "hash": "QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt",
@ -40,9 +40,9 @@
"version": "0.0.0" "version": "0.0.0"
}, },
{ {
"hash": "QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV", "hash": "Qmd5GW4ypC53YfF378JCHEmsQfGEDbtXpa5N5jPtoK2x4N",
"name": "gogo-protobuf", "name": "gogo-protobuf",
"version": "0.0.0" "version": "0.3.1"
}, },
{ {
"author": "cheggaaa", "author": "cheggaaa",
@ -70,9 +70,9 @@
}, },
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
"hash": "QmQdnfvZQuhdT93LNc5bos52wAmdr3G2p6G8teLJMEN32P", "hash": "QmXhhVSpXMUjpf9XgQDyePxug2iHm8ZvZD99aA9N6kuqMN",
"name": "go-libp2p-peerstore", "name": "go-libp2p-peerstore",
"version": "1.1.2" "version": "1.2.3"
}, },
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
@ -91,6 +91,48 @@
"hash": "QmWQ2SJisXwcCLsUXLwYCKSfyExXjFRW2WbBH5sqCUnwX5", "hash": "QmWQ2SJisXwcCLsUXLwYCKSfyExXjFRW2WbBH5sqCUnwX5",
"name": "bbloom", "name": "bbloom",
"version": "0.0.2" "version": "0.0.2"
},
{
"author": "whyrusleeping",
"hash": "QmXhU58jbgCbuAvo3Eq6VXg67yGSNArpzJwk3g54NuYVfx",
"name": "go-key",
"version": "1.0.1"
},
{
"author": "whyrusleeping",
"hash": "QmawCBGLXch5o1wpiGxZ7zERDUwmaVWLXeVuLBNCjFGSoe",
"name": "go-testutil",
"version": "1.0.1"
},
{
"author": "whyrusleeping",
"hash": "QmXrtCbBHacZAqRofuWY1M8TChGtiddF5xQrQ2Wy9rMSmA",
"name": "go-libp2p-record",
"version": "1.0.0"
},
{
"author": "whyrusleeping",
"hash": "QmawBtuW8XoahofVAyAnTvWz3RaHzZ4ftsMH1wZP5j8zqj",
"name": "go-libp2p-kbucket",
"version": "1.0.1"
},
{
"author": "whyrusleeping",
"hash": "QmQ3MsUtakFm2htqYr1S2WGyA6A3jmiRa6yUuxiZJNwK42",
"name": "go-libp2p-routing",
"version": "1.0.0"
},
{
"author": "whyrusleeping",
"hash": "QmQNQhNmY4STU1MURjH9vYEMpx2ncMS4gbwxXWtrEjzVAq",
"name": "go-todocounter",
"version": "1.0.1"
},
{
"author": "whyrusleeping",
"hash": "Qmf4ETeAWXuThBfWwonVyFqGFSgTWepUDEr1txcctvpTXS",
"name": "go-libp2p",
"version": "3.4.1"
} }
], ],
"gxVersion": "0.4.0", "gxVersion": "0.4.0",

View File

@ -10,17 +10,22 @@ It is generated from these files:
It has these top-level messages: It has these top-level messages:
Message Message
Record
*/ */
package dht_pb package dht_pb
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math" import math "math"
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
const _ = proto.GoGoProtoPackageIsVersion1
type Message_MessageType int32 type Message_MessageType int32
const ( const (
@ -65,6 +70,7 @@ func (x *Message_MessageType) UnmarshalJSON(data []byte) error {
*x = Message_MessageType(value) *x = Message_MessageType(value)
return nil return nil
} }
func (Message_MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptorDht, []int{0, 0} }
type Message_ConnectionType int32 type Message_ConnectionType int32
@ -109,6 +115,7 @@ func (x *Message_ConnectionType) UnmarshalJSON(data []byte) error {
*x = Message_ConnectionType(value) *x = Message_ConnectionType(value)
return nil return nil
} }
func (Message_ConnectionType) EnumDescriptor() ([]byte, []int) { return fileDescriptorDht, []int{0, 1} }
type Message struct { type Message struct {
// defines what type of message it is. // defines what type of message it is.
@ -120,7 +127,7 @@ type Message struct {
Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"`
// Used to return a value // Used to return a value
// PUT_VALUE, GET_VALUE // PUT_VALUE, GET_VALUE
Record *Record `protobuf:"bytes,3,opt,name=record" json:"record,omitempty"` Record *record_pb.Record `protobuf:"bytes,3,opt,name=record" json:"record,omitempty"`
// Used to return peers closer to a key in a query // Used to return peers closer to a key in a query
// GET_VALUE, GET_PROVIDERS, FIND_NODE // GET_VALUE, GET_PROVIDERS, FIND_NODE
CloserPeers []*Message_Peer `protobuf:"bytes,8,rep,name=closerPeers" json:"closerPeers,omitempty"` CloserPeers []*Message_Peer `protobuf:"bytes,8,rep,name=closerPeers" json:"closerPeers,omitempty"`
@ -130,9 +137,10 @@ type Message struct {
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *Message) Reset() { *m = Message{} } func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) } func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {} func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorDht, []int{0} }
func (m *Message) GetType() Message_MessageType { func (m *Message) GetType() Message_MessageType {
if m != nil && m.Type != nil { if m != nil && m.Type != nil {
@ -155,7 +163,7 @@ func (m *Message) GetKey() string {
return "" return ""
} }
func (m *Message) GetRecord() *Record { func (m *Message) GetRecord() *record_pb.Record {
if m != nil { if m != nil {
return m.Record return m.Record
} }
@ -186,9 +194,10 @@ type Message_Peer struct {
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *Message_Peer) Reset() { *m = Message_Peer{} } func (m *Message_Peer) Reset() { *m = Message_Peer{} }
func (m *Message_Peer) String() string { return proto.CompactTextString(m) } func (m *Message_Peer) String() string { return proto.CompactTextString(m) }
func (*Message_Peer) ProtoMessage() {} func (*Message_Peer) ProtoMessage() {}
func (*Message_Peer) Descriptor() ([]byte, []int) { return fileDescriptorDht, []int{0, 0} }
func (m *Message_Peer) GetId() string { func (m *Message_Peer) GetId() string {
if m != nil && m.Id != nil { if m != nil && m.Id != nil {
@ -211,62 +220,37 @@ func (m *Message_Peer) GetConnection() Message_ConnectionType {
return Message_NOT_CONNECTED return Message_NOT_CONNECTED
} }
// Record represents a dht record that contains a value
// for a key value pair
type Record struct {
// The key that references this record
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
// The actual value this record is storing
Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
// hash of the authors public key
Author *string `protobuf:"bytes,3,opt,name=author" json:"author,omitempty"`
// A PKI signature for the key+value+author
Signature []byte `protobuf:"bytes,4,opt,name=signature" json:"signature,omitempty"`
// Time the record was received, set by receiver
TimeReceived *string `protobuf:"bytes,5,opt,name=timeReceived" json:"timeReceived,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Record) Reset() { *m = Record{} }
func (m *Record) String() string { return proto.CompactTextString(m) }
func (*Record) ProtoMessage() {}
func (m *Record) GetKey() string {
if m != nil && m.Key != nil {
return *m.Key
}
return ""
}
func (m *Record) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
func (m *Record) GetAuthor() string {
if m != nil && m.Author != nil {
return *m.Author
}
return ""
}
func (m *Record) GetSignature() []byte {
if m != nil {
return m.Signature
}
return nil
}
func (m *Record) GetTimeReceived() string {
if m != nil && m.TimeReceived != nil {
return *m.TimeReceived
}
return ""
}
func init() { func init() {
proto.RegisterType((*Message)(nil), "dht.pb.Message")
proto.RegisterType((*Message_Peer)(nil), "dht.pb.Message.Peer")
proto.RegisterEnum("dht.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value) proto.RegisterEnum("dht.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value)
proto.RegisterEnum("dht.pb.Message_ConnectionType", Message_ConnectionType_name, Message_ConnectionType_value) proto.RegisterEnum("dht.pb.Message_ConnectionType", Message_ConnectionType_name, Message_ConnectionType_value)
} }
var fileDescriptorDht = []byte{
// 372 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x4d, 0x8f, 0x9a, 0x50,
0x14, 0x86, 0xcb, 0x87, 0x56, 0x0e, 0x8a, 0x78, 0xe2, 0x82, 0xd8, 0xa4, 0x31, 0xae, 0xec, 0x86,
0x26, 0x2e, 0xba, 0xe8, 0xa2, 0x09, 0x01, 0x6a, 0x4c, 0xec, 0xc5, 0xdc, 0xa2, 0x5d, 0x12, 0x85,
0x9b, 0x0e, 0x19, 0x22, 0x06, 0x18, 0x27, 0xfe, 0xc2, 0xf9, 0x5b, 0x73, 0x01, 0x99, 0x41, 0x17,
0xb3, 0xba, 0xef, 0x39, 0xf7, 0x79, 0xcf, 0x17, 0x28, 0xd1, 0x43, 0x61, 0x9e, 0xb2, 0xb4, 0x48,
0xb1, 0x5b, 0xc9, 0xc3, 0xa4, 0x9f, 0xb1, 0x30, 0xcd, 0xa2, 0x3a, 0x3b, 0x7b, 0x91, 0xe1, 0xf3,
0x1f, 0x96, 0xe7, 0xfb, 0xff, 0x0c, 0xbf, 0x83, 0x5c, 0x5c, 0x4e, 0xcc, 0x10, 0xa6, 0xc2, 0x5c,
0x5b, 0x7c, 0x31, 0x6b, 0x83, 0x79, 0xfd, 0x6e, 0x5e, 0x9f, 0x23, 0xb4, 0x02, 0x71, 0x0e, 0xc3,
0x30, 0x79, 0xca, 0x0b, 0x96, 0xad, 0xd9, 0x99, 0x25, 0x74, 0xff, 0x6c, 0x00, 0xf7, 0x76, 0xe8,
0x7d, 0x1a, 0x75, 0x90, 0x1e, 0xd9, 0xc5, 0x10, 0xf9, 0xaf, 0x42, 0x4b, 0x89, 0xdf, 0xa0, 0x5b,
0x0f, 0x62, 0x48, 0x3c, 0xa9, 0x2e, 0x46, 0x66, 0x33, 0xd7, 0xc1, 0xa4, 0x95, 0xa2, 0x57, 0x00,
0x7f, 0x80, 0x1a, 0x26, 0x69, 0xce, 0xb2, 0x0d, 0x63, 0x59, 0x6e, 0xf4, 0xa6, 0x12, 0xe7, 0xc7,
0xf7, 0xe3, 0x95, 0x9f, 0xb4, 0x0d, 0xe2, 0x4f, 0x18, 0xf0, 0x25, 0xcf, 0x71, 0xd4, 0x38, 0x95,
0x0f, 0x9c, 0xb7, 0xe8, 0x24, 0x01, 0xb9, 0x14, 0xa8, 0x81, 0x18, 0x47, 0xd5, 0x45, 0x14, 0xca,
0x15, 0x8e, 0xa1, 0xb3, 0x8f, 0x22, 0x5e, 0x4b, 0xe4, 0xb5, 0xfa, 0xb4, 0x0e, 0xf0, 0x17, 0x40,
0x98, 0x1e, 0x8f, 0x2c, 0x2c, 0xe2, 0xf4, 0x58, 0x2d, 0xa4, 0x2d, 0xbe, 0xde, 0xb7, 0xb1, 0xdf,
0x88, 0xea, 0x84, 0x2d, 0xc7, 0x2c, 0x06, 0xb5, 0x75, 0x5d, 0x1c, 0x80, 0xb2, 0xd9, 0xfa, 0xc1,
0xce, 0x5a, 0x6f, 0x5d, 0xfd, 0x53, 0x19, 0x2e, 0xdd, 0x26, 0x14, 0xf8, 0x2d, 0xfb, 0x96, 0xe3,
0x04, 0x1b, 0xea, 0xed, 0x56, 0x8e, 0x4b, 0x75, 0x11, 0x47, 0x30, 0x28, 0x81, 0x26, 0xf3, 0x57,
0x97, 0x4a, 0xcf, 0xef, 0x15, 0x71, 0x02, 0xe2, 0x39, 0xae, 0x2e, 0x63, 0x8f, 0xaf, 0xb3, 0x22,
0x4b, 0xbd, 0x33, 0xfb, 0x07, 0xda, 0xed, 0x20, 0xa5, 0x9b, 0x78, 0x7e, 0x60, 0x7b, 0x84, 0xb8,
0xb6, 0xef, 0x3a, 0x75, 0xc7, 0xf7, 0x50, 0xc0, 0x21, 0xa8, 0xb6, 0x45, 0x1a, 0x82, 0x37, 0x44,
0x5e, 0xc4, 0x22, 0x2d, 0x97, 0x2e, 0xbd, 0x06, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x4c, 0x62, 0x25,
0x6b, 0x02, 0x00, 0x00,
}

View File

@ -1,6 +1,14 @@
// In order to re-generate the golang packages for `Message` you will need...
// 1. Protobuf binary (tested with protoc 3.0.0). - https://github.com/gogo/protobuf/releases
// 2. Gogo Protobuf (tested with gogo 0.3). - https://github.com/gogo/protobuf
// 3. To have cloned `libp2p/go-libp2p-{record,kad-dht}` under the same directory.
// Now from `libp2p/go-libp2p-kad-dht/pb` you can run...
// `protoc --gogo_out=. --proto_path=../../go-libp2p-record/pb/ --proto_path=./ dht.proto`
syntax = "proto2";
package dht.pb; package dht.pb;
//run `protoc --go_out=. *.proto` to generate import "record.proto";
message Message { message Message {
enum MessageType { enum MessageType {
@ -50,7 +58,7 @@ message Message {
// Used to return a value // Used to return a value
// PUT_VALUE, GET_VALUE // PUT_VALUE, GET_VALUE
optional Record record = 3; optional record.pb.Record record = 3;
// Used to return peers closer to a key in a query // Used to return peers closer to a key in a query
// GET_VALUE, GET_PROVIDERS, FIND_NODE // GET_VALUE, GET_PROVIDERS, FIND_NODE
@ -60,22 +68,3 @@ message Message {
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
repeated Peer providerPeers = 9; repeated Peer providerPeers = 9;
} }
// Record represents a dht record that contains a value
// for a key value pair
message Record {
// The key that references this record
optional string key = 1;
// The actual value this record is storing
optional bytes value = 2;
// hash of the authors public key
optional string author = 3;
// A PKI signature for the key+value+author
optional bytes signature = 4;
// Time the record was received, set by receiver
optional string timeReceived = 5;
}

View File

@ -3,11 +3,11 @@ package dht_pb
import ( import (
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-key"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
inet "github.com/ipfs/go-libp2p/p2p/net"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
inet "github.com/libp2p/go-libp2p/p2p/net"
) )
var log = logging.Logger("dht.pb") var log = logging.Logger("dht.pb")

View File

@ -9,27 +9,18 @@ import (
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query" dsq "github.com/ipfs/go-datastore/query"
key "github.com/ipfs/go-key"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
goprocess "github.com/jbenet/goprocess" goprocess "github.com/jbenet/goprocess"
goprocessctx "github.com/jbenet/goprocess/context" goprocessctx "github.com/jbenet/goprocess/context"
autobatch "github.com/whyrusleeping/autobatch" autobatch "github.com/whyrusleeping/autobatch"
base32 "github.com/whyrusleeping/base32" base32 "github.com/whyrusleeping/base32"
key "github.com/ipfs/go-ipfs/blocks/key"
flags "github.com/ipfs/go-ipfs/flags"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )
var batchBufferSize = 256 var batchBufferSize = 256
func init() {
if flags.LowMemMode {
batchBufferSize = 8
}
}
var log = logging.Logger("providers") var log = logging.Logger("providers")
var lruCacheSize = 256 var lruCacheSize = 256

View File

@ -6,9 +6,8 @@ import (
"time" "time"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-key"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -3,19 +3,18 @@ package dht
import ( import (
"sync" "sync"
key "github.com/ipfs/go-ipfs/blocks/key"
notif "github.com/ipfs/go-ipfs/notifications"
"github.com/ipfs/go-ipfs/routing"
pset "github.com/ipfs/go-ipfs/thirdparty/peerset"
todoctr "github.com/ipfs/go-ipfs/thirdparty/todocounter"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
key "github.com/ipfs/go-key"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pset "github.com/ipfs/go-libp2p-peer/peerset"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
queue "github.com/ipfs/go-libp2p-peerstore/queue" queue "github.com/ipfs/go-libp2p-peerstore/queue"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
todoctr "github.com/ipfs/go-todocounter"
process "github.com/jbenet/goprocess" process "github.com/jbenet/goprocess"
ctxproc "github.com/jbenet/goprocess/context" ctxproc "github.com/jbenet/goprocess/context"
routing "github.com/libp2p/go-libp2p-routing"
notif "github.com/libp2p/go-libp2p-routing/notifications"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )

View File

@ -4,12 +4,12 @@ import (
"fmt" "fmt"
"time" "time"
routing "github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
record "github.com/ipfs/go-ipfs/routing/record"
ci "github.com/ipfs/go-libp2p-crypto" ci "github.com/ipfs/go-libp2p-crypto"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
ctxfrac "github.com/jbenet/go-context/frac" ctxfrac "github.com/jbenet/go-context/frac"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
record "github.com/libp2p/go-libp2p-record"
routing "github.com/libp2p/go-libp2p-routing"
"golang.org/x/net/context" "golang.org/x/net/context"
) )

View File

@ -7,17 +7,16 @@ import (
"sync" "sync"
"time" "time"
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-key"
notif "github.com/ipfs/go-ipfs/notifications"
"github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb"
kb "github.com/ipfs/go-ipfs/routing/kbucket"
record "github.com/ipfs/go-ipfs/routing/record"
pset "github.com/ipfs/go-ipfs/thirdparty/peerset"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pset "github.com/ipfs/go-libp2p-peer/peerset"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
inet "github.com/ipfs/go-libp2p/p2p/net" pb "github.com/libp2p/go-libp2p-kad-dht/pb"
kb "github.com/libp2p/go-libp2p-kbucket"
record "github.com/libp2p/go-libp2p-record"
routing "github.com/libp2p/go-libp2p-routing"
notif "github.com/libp2p/go-libp2p-routing/notifications"
inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )