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-routing
Commits
f1397e31
Commit
f1397e31
authored
Nov 24, 2015
by
rht
Committed by
Jeromy
Jan 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strings.Split -> path.SplitList
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
65f87fd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
record/selection.go
record/selection.go
+2
-2
record/validation.go
record/validation.go
+3
-3
No files found.
record/selection.go
View file @
f1397e31
...
@@ -2,9 +2,9 @@ package record
...
@@ -2,9 +2,9 @@ package record
import
(
import
(
"errors"
"errors"
"strings"
key
"github.com/ipfs/go-ipfs/blocks/key"
key
"github.com/ipfs/go-ipfs/blocks/key"
path
"github.com/ipfs/go-ipfs/path"
)
)
// A SelectorFunc selects the best value for the given key from
// A SelectorFunc selects the best value for the given key from
...
@@ -18,7 +18,7 @@ func (s Selector) BestRecord(k key.Key, recs [][]byte) (int, error) {
...
@@ -18,7 +18,7 @@ func (s Selector) BestRecord(k key.Key, recs [][]byte) (int, error) {
return
0
,
errors
.
New
(
"no records given!"
)
return
0
,
errors
.
New
(
"no records given!"
)
}
}
parts
:=
strings
.
Split
(
string
(
k
)
,
"/"
)
parts
:=
path
.
Split
List
(
string
(
k
))
if
len
(
parts
)
<
3
{
if
len
(
parts
)
<
3
{
log
.
Infof
(
"Record key does not have selectorfunc: %s"
,
k
)
log
.
Infof
(
"Record key does not have selectorfunc: %s"
,
k
)
return
0
,
errors
.
New
(
"record key does not have selectorfunc"
)
return
0
,
errors
.
New
(
"record key does not have selectorfunc"
)
...
...
record/validation.go
View file @
f1397e31
...
@@ -3,10 +3,10 @@ package record
...
@@ -3,10 +3,10 @@ package record
import
(
import
(
"bytes"
"bytes"
"errors"
"errors"
"strings"
key
"github.com/ipfs/go-ipfs/blocks/key"
key
"github.com/ipfs/go-ipfs/blocks/key"
ci
"github.com/ipfs/go-ipfs/p2p/crypto"
ci
"github.com/ipfs/go-ipfs/p2p/crypto"
path
"github.com/ipfs/go-ipfs/path"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
u
"github.com/ipfs/go-ipfs/util"
u
"github.com/ipfs/go-ipfs/util"
)
)
...
@@ -37,7 +37,7 @@ type ValidChecker struct {
...
@@ -37,7 +37,7 @@ type ValidChecker struct {
// It runs needed validators
// It runs needed validators
func
(
v
Validator
)
VerifyRecord
(
r
*
pb
.
Record
)
error
{
func
(
v
Validator
)
VerifyRecord
(
r
*
pb
.
Record
)
error
{
// Now, check validity func
// Now, check validity func
parts
:=
strings
.
Split
(
r
.
GetKey
()
,
"/"
)
parts
:=
path
.
Split
List
(
r
.
GetKey
())
if
len
(
parts
)
<
3
{
if
len
(
parts
)
<
3
{
log
.
Infof
(
"Record key does not have validator: %s"
,
key
.
Key
(
r
.
GetKey
()))
log
.
Infof
(
"Record key does not have validator: %s"
,
key
.
Key
(
r
.
GetKey
()))
return
nil
return
nil
...
@@ -54,7 +54,7 @@ func (v Validator) VerifyRecord(r *pb.Record) error {
...
@@ -54,7 +54,7 @@ func (v Validator) VerifyRecord(r *pb.Record) error {
func
(
v
Validator
)
IsSigned
(
k
key
.
Key
)
(
bool
,
error
)
{
func
(
v
Validator
)
IsSigned
(
k
key
.
Key
)
(
bool
,
error
)
{
// Now, check validity func
// Now, check validity func
parts
:=
strings
.
Split
(
string
(
k
)
,
"/"
)
parts
:=
path
.
Split
List
(
string
(
k
))
if
len
(
parts
)
<
3
{
if
len
(
parts
)
<
3
{
log
.
Infof
(
"Record key does not have validator: %s"
,
k
)
log
.
Infof
(
"Record key does not have validator: %s"
,
k
)
return
false
,
nil
return
false
,
nil
...
...
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