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
dms3
go-dms3
Commits
1cf7a182
Commit
1cf7a182
authored
10 years ago
by
Jeromy
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validator functions and ipns completion
parent
cb23d5b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
namesys/publisher.go
namesys/publisher.go
+1
-1
namesys/routing.go
namesys/routing.go
+1
-1
routing/dht/dht.go
routing/dht/dht.go
+3
-0
routing/dht/records.go
routing/dht/records.go
+10
-0
No files found.
namesys/publisher.go
View file @
1cf7a182
...
...
@@ -53,7 +53,7 @@ func (p *ipnsPublisher) Publish(k ci.PrivKey, value string) error {
// Store associated public key
timectx
,
_
:=
context
.
WithDeadline
(
ctx
,
time
.
Now
()
.
Add
(
time
.
Second
*
4
))
err
=
p
.
routing
.
PutValue
(
timectx
,
u
.
Key
(
nameb
),
pkbytes
)
err
=
p
.
routing
.
PutValue
(
timectx
,
u
.
Key
(
"/pk/"
+
string
(
nameb
)
)
,
pkbytes
)
if
err
!=
nil
{
return
err
}
...
...
This diff is collapsed.
Click to expand it.
namesys/routing.go
View file @
1cf7a182
...
...
@@ -63,7 +63,7 @@ func (r *routingResolver) Resolve(name string) (string, error) {
// name should be a public key retrievable from ipfs
// /ipfs/<name>
key
:=
u
.
Key
(
hash
)
key
:=
u
.
Key
(
"/pk/"
+
string
(
hash
)
)
pkval
,
err
:=
r
.
routing
.
GetValue
(
ctx
,
key
)
if
err
!=
nil
{
log
.
Warning
(
"RoutingResolve PubKey Get failed."
)
...
...
This diff is collapsed.
Click to expand it.
routing/dht/dht.go
View file @
1cf7a182
...
...
@@ -84,7 +84,10 @@ func NewDHT(ctx context.Context, p peer.Peer, ps peer.Peerstore, dialer inet.Dia
dht
.
routingTables
[
1
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
()),
time
.
Millisecond
*
1000
)
dht
.
routingTables
[
2
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
()),
time
.
Hour
)
dht
.
birth
=
time
.
Now
()
dht
.
Validators
=
make
(
map
[
string
]
ValidatorFunc
)
dht
.
Validators
[
"ipns"
]
=
ValidateIpnsRecord
dht
.
Validators
[
"pk"
]
=
ValidatePublicKeyRecord
if
doPinging
{
dht
.
Children
()
.
Add
(
1
)
...
...
This diff is collapsed.
Click to expand it.
routing/dht/records.go
View file @
1cf7a182
...
...
@@ -69,3 +69,13 @@ func (dht *IpfsDHT) verifyRecord(r *pb.Record) error {
return
fnc
(
u
.
Key
(
r
.
GetKey
()),
r
.
GetValue
())
}
func
ValidateIpnsRecord
(
k
u
.
Key
,
val
[]
byte
)
error
{
// TODO:
return
nil
}
func
ValidatePublicKeyRecord
(
k
u
.
Key
,
val
[]
byte
)
error
{
// TODO:
return
nil
}
This diff is collapsed.
Click to expand it.
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