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-kad-dht
Commits
c088dcb1
Commit
c088dcb1
authored
Jan 16, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some comments
parent
71f6e255
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
dht.go
dht.go
+2
-0
records.go
records.go
+3
-1
No files found.
dht.go
View file @
c088dcb1
...
...
@@ -235,6 +235,8 @@ func (dht *IpfsDHT) getLocal(key u.Key) ([]byte, error) {
return
rec
.
GetValue
(),
nil
}
// getOwnPrivateKey attempts to load the local peers private
// key from the peerstore.
func
(
dht
*
IpfsDHT
)
getOwnPrivateKey
()
(
ci
.
PrivKey
,
error
)
{
sk
:=
dht
.
peerstore
.
PrivKey
(
dht
.
self
)
if
sk
==
nil
{
...
...
records.go
View file @
c088dcb1
...
...
@@ -42,7 +42,7 @@ func RecordBlobForSig(r *pb.Record) []byte {
return
bytes
.
Join
([][]
byte
{
k
,
v
,
a
},
[]
byte
{})
}
// creates and signs a dht record for the given key/value pair
//
MakePutRecord
creates and signs a dht record for the given key/value pair
func
MakePutRecord
(
sk
ci
.
PrivKey
,
key
u
.
Key
,
value
[]
byte
)
(
*
pb
.
Record
,
error
)
{
record
:=
new
(
pb
.
Record
)
...
...
@@ -175,6 +175,8 @@ func (dht *IpfsDHT) verifyRecordOnline(ctx context.Context, r *pb.Record) error
return
dht
.
verifyRecord
(
r
,
pk
)
}
// TODO: make this an independent exported function.
// it might be useful for users to have access to.
func
(
dht
*
IpfsDHT
)
verifyRecord
(
r
*
pb
.
Record
,
pk
ci
.
PubKey
)
error
{
// First, validate the signature
blob
:=
RecordBlobForSig
(
r
)
...
...
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