Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kbucket
Commits
7a793847
Commit
7a793847
authored
Sep 29, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no longer use 'key' type
parent
b4fe1c0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
package.json
package.json
+0
-5
util.go
util.go
+2
-3
No files found.
package.json
View file @
7a793847
...
...
@@ -33,11 +33,6 @@
"hash"
:
"QmYpVUnnedgGrp6cX2pBii5HRQgcSr778FiKVe7o7nF5Z3"
,
"name"
:
"go-testutil"
,
"version"
:
"1.0.2"
},
{
"hash"
:
"Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew"
,
"name"
:
"go-key"
,
"version"
:
"1.0.2"
}
],
"gxVersion"
:
"0.4.0"
,
...
...
util.go
View file @
7a793847
...
...
@@ -6,7 +6,6 @@ import (
"errors"
u
"github.com/ipfs/go-ipfs-util"
key
"github.com/ipfs/go-key"
peer
"github.com/ipfs/go-libp2p-peer"
ks
"github.com/libp2p/go-libp2p-kbucket/keyspace"
)
...
...
@@ -46,13 +45,13 @@ func ConvertPeerID(id peer.ID) ID {
}
// ConvertKey creates a DHT ID by hashing a local key (String)
func
ConvertKey
(
id
key
.
Key
)
ID
{
func
ConvertKey
(
id
string
)
ID
{
hash
:=
sha256
.
Sum256
([]
byte
(
id
))
return
hash
[
:
]
}
// Closer returns true if a is closer to key than b is
func
Closer
(
a
,
b
peer
.
ID
,
key
key
.
Key
)
bool
{
func
Closer
(
a
,
b
peer
.
ID
,
key
string
)
bool
{
aid
:=
ConvertPeerID
(
a
)
bid
:=
ConvertPeerID
(
b
)
tgt
:=
ConvertKey
(
key
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment