Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
35da0885
提交
35da0885
authored
8月 20, 2017
作者:
Łukasz Magiera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
daemon: config option for routing
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
3cbf97be
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
36 行增加
和
5 行删除
+36
-5
daemon.go
cmd/ipfs/daemon.go
+18
-0
config.md
docs/config.md
+7
-0
discovery.go
repo/config/discovery.go
+4
-1
init.go
repo/config/init.go
+7
-4
没有找到文件。
cmd/ipfs/daemon.go
浏览文件 @
35da0885
...
...
@@ -45,6 +45,7 @@ const (
routingOptionDHTClientKwd
=
"dhtclient"
routingOptionDHTKwd
=
"dht"
routingOptionNoneKwd
=
"none"
routingOptionDefaultKwd
=
"default"
unencryptTransportKwd
=
"disable-transport-encryption"
unrestrictedApiAccessKwd
=
"unrestricted-api"
writableKwd
=
"writable"
...
...
@@ -151,6 +152,7 @@ Headers.
cmdkit
.
BoolOption
(
initOptionKwd
,
"Initialize ipfs with default settings if not already initialized"
),
cmdkit
.
StringOption
(
initProfileOptionKwd
,
"Configuration profiles to apply for --init. See ipfs init --help for more"
),
cmdkit
.
StringOption
(
routingOptionKwd
,
"Overrides the routing option"
)
.
WithDefault
(
"dht"
),
cmdkit
.
StringOption
(
routingOptionKwd
,
"Overrides the routing option"
)
.
WithDefault
(
"default"
),
cmdkit
.
BoolOption
(
mountKwd
,
"Mounts IPFS to the filesystem"
),
cmdkit
.
BoolOption
(
writableKwd
,
"Enable writing objects (with POST, PUT and DELETE)"
),
cmdkit
.
StringOption
(
ipfsMountKwd
,
"Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."
),
...
...
@@ -300,6 +302,22 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
}
routingOption
,
_
:=
req
.
Options
[
routingOptionKwd
]
.
(
string
)
if
err
!=
nil
{
re
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
if
routingOption
==
routingOptionDefaultKwd
{
cfg
,
err
:=
repo
.
Config
()
if
err
!=
nil
{
re
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
routingOption
=
cfg
.
Discovery
.
Routing
if
routingOption
==
""
{
routingOption
=
routingOptionDHTKwd
}
}
switch
routingOption
{
case
routingOptionSupernodeKwd
:
re
.
SetError
(
errors
.
New
(
"supernode routing was never fully implemented and has been removed"
),
cmdkit
.
ErrNormal
)
...
...
docs/config.md
浏览文件 @
35da0885
...
...
@@ -197,6 +197,13 @@ Default: `true`
-
`Interval`
A number of seconds to wait between discovery checks.
-
`Routing`
Content routing mode. Can be overridden with daemon
`--routing`
flag.
Valid modes are:
-
`dht`
(default)
-
`dhtclient`
-
`none`
-
`supernode`
(deprecated)
## `Gateway`
Options for the HTTP gateway.
...
...
repo/config/discovery.go
浏览文件 @
35da0885
package
config
type
Discovery
struct
{
MDNS
MDNS
MDNS
MDNS
//Routing sets default daemon routing mode.
Routing
string
}
type
MDNS
struct
{
...
...
repo/config/init.go
浏览文件 @
35da0885
...
...
@@ -38,10 +38,13 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
Datastore
:
datastore
,
Bootstrap
:
BootstrapPeerStrings
(
bootstrapPeers
),
Identity
:
identity
,
Discovery
:
Discovery
{
MDNS
{
Enabled
:
true
,
Interval
:
10
,
}},
Discovery
:
Discovery
{
MDNS
:
MDNS
{
Enabled
:
true
,
Interval
:
10
,
},
Routing
:
"dht"
,
},
// setup the node mount points.
Mounts
:
Mounts
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论