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
2b84b2ba
Commit
2b84b2ba
authored
May 21, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix linter nits and tests that don't compile
parent
cf3b6c43
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
25 deletions
+26
-25
core/commands/dht.go
core/commands/dht.go
+8
-8
core/commands/swarm.go
core/commands/swarm.go
+10
-9
core/node/libp2p/addrs.go
core/node/libp2p/addrs.go
+1
-1
namesys/resolve/pathresolver_test.go
namesys/resolve/pathresolver_test.go
+6
-6
plugin/plugins/gen_main.sh
plugin/plugins/gen_main.sh
+1
-1
No files found.
core/commands/dht.go
View file @
2b84b2ba
...
...
@@ -494,15 +494,15 @@ Different key types can specify other 'best' rules.
pfm
:=
pfuncMap
{
notif
.
Value
:
func
(
obj
*
notif
.
QueryEvent
,
out
io
.
Writer
,
verbose
bool
)
error
{
if
verbose
{
fmt
.
Fprintf
(
out
,
"got value: '%s'
\n
"
,
obj
.
Extra
)
}
else
{
res
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
obj
.
Extra
)
if
err
!=
nil
{
return
err
}
out
.
Write
(
res
)
_
,
err
:=
fmt
.
Fprintf
(
out
,
"got value: '%s'
\n
"
,
obj
.
Extra
)
return
err
}
return
nil
res
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
obj
.
Extra
)
if
err
!=
nil
{
return
err
}
_
,
err
=
out
.
Write
(
res
)
return
err
},
}
...
...
core/commands/swarm.go
View file @
2b84b2ba
...
...
@@ -22,9 +22,10 @@ import (
peer
"github.com/libp2p/go-libp2p-peer"
pstore
"github.com/libp2p/go-libp2p-peerstore"
swarm
"github.com/libp2p/go-libp2p-swarm"
mafilter
"github.com/libp2p/go-maddr-filter"
ma
"github.com/multiformats/go-multiaddr"
madns
"github.com/multiformats/go-multiaddr-dns"
ma
filter
"github.com/whyrusleeping/multiaddr-filter"
ma
mask
"github.com/whyrusleeping/multiaddr-filter"
)
const
(
...
...
@@ -599,8 +600,8 @@ Filters default to those specified under the "Swarm.AddrFilters" config key.
}
var
output
[]
string
for
_
,
f
:=
range
swrm
.
Filters
.
Filters
(
)
{
s
,
err
:=
ma
filter
.
ConvertIPNet
(
f
)
for
_
,
f
:=
range
swrm
.
Filters
.
Filters
ForAction
(
mafilter
.
ActionDeny
)
{
s
,
err
:=
ma
mask
.
ConvertIPNet
(
&
f
)
if
err
!=
nil
{
return
err
}
...
...
@@ -657,12 +658,12 @@ add your filters to the ipfs config file.
}
for
_
,
arg
:=
range
req
.
Arguments
{
mask
,
err
:=
ma
filter
.
NewMask
(
arg
)
mask
,
err
:=
ma
mask
.
NewMask
(
arg
)
if
err
!=
nil
{
return
err
}
swrm
.
Filters
.
Add
Dial
Filter
(
mask
)
swrm
.
Filters
.
AddFilter
(
*
mask
,
mafilter
.
ActionDeny
)
}
added
,
err
:=
filtersAdd
(
r
,
cfg
,
req
.
Arguments
)
...
...
@@ -716,9 +717,9 @@ remove your filters from the ipfs config file.
}
if
req
.
Arguments
[
0
]
==
"all"
||
req
.
Arguments
[
0
]
==
"*"
{
fs
:=
swrm
.
Filters
.
Filters
(
)
fs
:=
swrm
.
Filters
.
Filters
ForAction
(
mafilter
.
ActionDeny
)
for
_
,
f
:=
range
fs
{
swrm
.
Filters
.
Remove
(
f
)
swrm
.
Filters
.
Remove
Literal
(
f
)
}
removed
,
err
:=
filtersRemoveAll
(
r
,
cfg
)
...
...
@@ -730,12 +731,12 @@ remove your filters from the ipfs config file.
}
for
_
,
arg
:=
range
req
.
Arguments
{
mask
,
err
:=
ma
filter
.
NewMask
(
arg
)
mask
,
err
:=
ma
mask
.
NewMask
(
arg
)
if
err
!=
nil
{
return
err
}
swrm
.
Filters
.
Remove
(
mask
)
swrm
.
Filters
.
Remove
Literal
(
*
mask
)
}
removed
,
err
:=
filtersRemove
(
r
,
cfg
,
req
.
Arguments
)
...
...
core/node/libp2p/addrs.go
View file @
2b84b2ba
...
...
@@ -39,7 +39,7 @@ func makeAddrsFactory(announce []string, noAnnounce []string) (p2pbhost.AddrsFac
for
_
,
addr
:=
range
noAnnounce
{
f
,
err
:=
mamask
.
NewMask
(
addr
)
if
err
==
nil
{
filters
.
Add
Dial
Filter
(
f
)
filters
.
AddFilter
(
*
f
,
mafilter
.
ActionDeny
)
continue
}
maddr
,
err
:=
ma
.
NewMultiaddr
(
addr
)
...
...
namesys/resolve/pathresolver_test.go
View file @
2b84b2ba
...
...
@@ -16,17 +16,17 @@ func TestResolveNoComponents(t *testing.T) {
}
_
,
err
=
resolve
.
Resolve
(
n
.
Context
(),
n
.
Namesys
,
n
.
Resolver
,
path
.
Path
(
"/ipns/"
))
if
err
!=
path
.
ErrNoComponents
{
t
.
Fatal
(
"Should error with no components (/ipns/)."
,
err
)
if
err
.
Error
()
!=
"invalid path
\"
/ipns/
\"
: ipns path missing IPNS ID"
{
t
.
Error
(
"Should error with no components (/ipns/)."
,
err
)
}
_
,
err
=
resolve
.
Resolve
(
n
.
Context
(),
n
.
Namesys
,
n
.
Resolver
,
path
.
Path
(
"/ipfs/"
))
if
err
!=
path
.
ErrNoC
omponents
{
t
.
Fatal
(
"Should error with no components (/ipfs/)."
,
err
)
if
err
.
Error
()
!=
"invalid path
\"
/ipfs/
\"
: not enough path c
omponents
"
{
t
.
Error
(
"Should error with no components (/ipfs/)."
,
err
)
}
_
,
err
=
resolve
.
Resolve
(
n
.
Context
(),
n
.
Namesys
,
n
.
Resolver
,
path
.
Path
(
"/../.."
))
if
err
!=
path
.
ErrBadPath
{
t
.
Fatal
(
"Should error with invalid path."
,
err
)
if
err
.
Error
()
!=
"invalid path
\"
/../..
\"
: unknown namespace
\"
..
\"
"
{
t
.
Error
(
"Should error with invalid path."
,
err
)
}
}
plugin/plugins/gen_main.sh
View file @
2b84b2ba
...
...
@@ -14,7 +14,7 @@ import (
$shortpkg
"
$pkg
"
)
var Plugins =
$shortpkg
.Plugins
var Plugins =
$shortpkg
.Plugins
//nolint
func main() {
panic("this is a plugin, build it as a plugin, this is here as for go#20312")
...
...
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