Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
ec7116ac
提交
ec7116ac
authored
12月 13, 2017
作者:
vyzo
提交者:
Łukasz Magiera
2月 05, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
namecache: make feature experimental with --enable-follow-experiment
License: MIT Signed-off-by:
vyzo
<
vyzo@hackzen.org
>
上级
40545856
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
10 行增加
和
3 行删除
+10
-3
daemon.go
cmd/ipfs/daemon.go
+4
-0
builder.go
core/builder.go
+1
-1
core.go
core/core.go
+5
-2
没有找到文件。
cmd/ipfs/daemon.go
浏览文件 @
ec7116ac
...
...
@@ -55,6 +55,7 @@ const (
enablePubSubKwd
=
"enable-pubsub-experiment"
enableIPNSPubSubKwd
=
"enable-namesys-pubsub"
enableMultiplexKwd
=
"enable-mplex-experiment"
enableFollowKwd
=
"enable-follow-experiment"
// apiAddrKwd = "address-api"
// swarmAddrKwd = "address-swarm"
)
...
...
@@ -167,6 +168,7 @@ Headers.
cmdkit
.
BoolOption
(
enablePubSubKwd
,
"Instantiate the ipfs daemon with the experimental pubsub feature enabled."
),
cmdkit
.
BoolOption
(
enableIPNSPubSubKwd
,
"Enable IPNS record distribution through pubsub; enables pubsub."
),
cmdkit
.
BoolOption
(
enableMultiplexKwd
,
"Add the experimental 'go-multiplex' stream muxer to libp2p on construction."
)
.
WithDefault
(
true
),
cmdkit
.
BoolOption
(
enableFollowKwd
,
"Enable IPNS name following."
),
// TODO: add way to override addresses. tricky part: updating the config if also --init.
// cmdkit.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
...
...
@@ -287,6 +289,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
ipnsps
,
_
:=
req
.
Options
[
enableIPNSPubSubKwd
]
.
(
bool
)
pubsub
,
_
:=
req
.
Options
[
enablePubSubKwd
]
.
(
bool
)
mplex
,
_
:=
req
.
Options
[
enableMultiplexKwd
]
.
(
bool
)
follow
,
_
:=
req
.
Option
(
enableFollowKwd
)
.
Bool
()
// Start assembling node config
ncfg
:=
&
core
.
BuildCfg
{
...
...
@@ -298,6 +301,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
"pubsub"
:
pubsub
,
"ipnsps"
:
ipnsps
,
"mplex"
:
mplex
,
"follow"
:
follow
,
},
//TODO(Kubuxu): refactor Online vs Offline by adding Permanent vs Ephemeral
}
...
...
core/builder.go
浏览文件 @
ec7116ac
...
...
@@ -256,7 +256,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
if
cfg
.
Online
{
do
:=
setupDiscoveryOption
(
rcfg
.
Discovery
)
if
err
:=
n
.
startOnlineServices
(
ctx
,
cfg
.
Routing
,
hostOption
,
do
,
cfg
.
getOpt
(
"pubsub"
),
cfg
.
getOpt
(
"ipnsps"
),
cfg
.
getOpt
(
"mplex"
));
err
!=
nil
{
if
err
:=
n
.
startOnlineServices
(
ctx
,
cfg
.
Routing
,
hostOption
,
do
,
cfg
.
getOpt
(
"pubsub"
),
cfg
.
getOpt
(
"ipnsps"
),
cfg
.
getOpt
(
"mplex"
)
,
cfg
.
getOpt
(
"follow"
)
);
err
!=
nil
{
return
err
}
}
else
{
...
...
core/core.go
浏览文件 @
ec7116ac
...
...
@@ -159,7 +159,7 @@ type Mounts struct {
Ipns
mount
.
Mount
}
func
(
n
*
IpfsNode
)
startOnlineServices
(
ctx
context
.
Context
,
routingOption
RoutingOption
,
hostOption
HostOption
,
do
DiscoveryOption
,
pubsub
,
ipnsps
,
mplex
bool
)
error
{
func
(
n
*
IpfsNode
)
startOnlineServices
(
ctx
context
.
Context
,
routingOption
RoutingOption
,
hostOption
HostOption
,
do
DiscoveryOption
,
pubsub
,
ipnsps
,
mplex
,
follow
bool
)
error
{
if
n
.
PeerHost
!=
nil
{
// already online.
return
errors
.
New
(
"node already online"
)
}
...
...
@@ -295,6 +295,10 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
n
.
P2P
=
p2p
.
NewP2P
(
n
.
Identity
,
n
.
PeerHost
,
n
.
Peerstore
)
if
follow
{
n
.
Namecache
=
namecache
.
NewNameCache
(
ctx
,
n
.
Namesys
,
n
.
Pinning
,
n
.
DAG
,
n
.
Blockstore
)
}
// setup local discovery
if
do
!=
nil
{
service
,
err
:=
do
(
ctx
,
n
.
PeerHost
)
...
...
@@ -590,7 +594,6 @@ func (n *IpfsNode) startOnlineServicesWithHost(ctx context.Context, routingOptio
// setup name system
n
.
Namesys
=
namesys
.
NewNameSystem
(
n
.
Routing
,
n
.
Repo
.
Datastore
(),
size
)
n
.
Namecache
=
namecache
.
NewNameCache
(
ctx
,
n
.
Namesys
,
n
.
Pinning
,
n
.
DAG
,
n
.
Blockstore
)
// setup ipns republishing
return
n
.
setupIpnsRepublisher
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论