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
e71ca7c5
Commit
e71ca7c5
authored
Sep 17, 2018
by
Kejie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor ipns command option name
License: MIT Signed-off-by:
Kejie Zhang
<
601172892@qq.com
>
parent
e4e35047
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
core/commands/name/ipns.go
core/commands/name/ipns.go
+15
-7
No files found.
core/commands/name/ipns.go
View file @
e71ca7c5
...
...
@@ -25,6 +25,13 @@ type ResolvedPath struct {
Path
path
.
Path
}
const
(
recursiveOptionName
=
"recursive"
nocacheOptionName
=
"nocache"
dhtRecordCountOptionName
=
"dht-record-count"
dhtTimeoutOptionName
=
"dht-timeout"
)
var
IpnsCmd
=
&
cmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Resolve IPNS names."
,
...
...
@@ -67,10 +74,10 @@ Resolve the value of a dnslink:
cmdkit
.
StringArg
(
"name"
,
false
,
false
,
"The IPNS name to resolve. Defaults to your node's peerID."
),
},
Options
:
[]
cmdkit
.
Option
{
cmdkit
.
BoolOption
(
"
recursive
"
,
"r"
,
"Resolve until the result is not an IPNS name."
),
cmdkit
.
BoolOption
(
"
nocache
"
,
"n"
,
"Do not use cached entries."
),
cmdkit
.
UintOption
(
"
dht
-r
ecord
-c
ount
"
,
"dhtrc"
,
"Number of records to request for DHT resolution."
),
cmdkit
.
StringOption
(
"
dht
-t
imeout
"
,
"dhtt"
,
"Max time to collect values during DHT resolution eg
\"
30s
\"
. Pass 0 for no timeout."
),
cmdkit
.
BoolOption
(
recursive
OptionName
,
"r"
,
"Resolve until the result is not an IPNS name."
),
cmdkit
.
BoolOption
(
nocache
OptionName
,
"n"
,
"Do not use cached entries."
),
cmdkit
.
UintOption
(
dht
R
ecord
C
ount
OptionName
,
"dhtrc"
,
"Number of records to request for DHT resolution."
),
cmdkit
.
StringOption
(
dht
T
imeout
OptionName
,
"dhtt"
,
"Max time to collect values during DHT resolution eg
\"
30s
\"
. Pass 0 for no timeout."
),
},
Run
:
func
(
req
*
cmds
.
Request
,
res
cmds
.
ResponseEmitter
,
env
cmds
.
Environment
)
{
n
,
err
:=
cmdenv
.
GetNode
(
env
)
...
...
@@ -119,9 +126,10 @@ Resolve the value of a dnslink:
name
=
req
.
Arguments
[
0
]
}
recursive
,
_
:=
req
.
Options
[
"recursive"
]
.
(
bool
)
rc
,
rcok
:=
req
.
Options
[
"dht-record-count"
]
.
(
int
)
dhtt
,
dhttok
:=
req
.
Options
[
"dht-timeout"
]
.
(
string
)
recursive
,
_
:=
req
.
Options
[
recursiveOptionName
]
.
(
bool
)
rc
,
rcok
:=
req
.
Options
[
dhtRecordCountOptionName
]
.
(
int
)
dhtt
,
dhttok
:=
req
.
Options
[
dhtTimeoutOptionName
]
.
(
string
)
var
ropts
[]
nsopts
.
ResolveOpt
if
!
recursive
{
ropts
=
append
(
ropts
,
nsopts
.
Depth
(
1
))
...
...
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