Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
a5233fae
提交
a5233fae
authored
1月 16, 2015
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some comments
上级
feeada0d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
14 行增加
和
1 行删除
+14
-1
core.go
core/core.go
+3
-0
ipns_unix.go
fuse/ipns/ipns_unix.go
+2
-0
dht.go
routing/dht/dht.go
+2
-0
records.go
routing/dht/records.go
+3
-1
offline.go
routing/offline/offline.go
+4
-0
没有找到文件。
core/core.go
浏览文件 @
a5233fae
...
...
@@ -355,6 +355,9 @@ func (n *IpfsNode) loadPrivateKey() error {
return
nil
}
// SetupOfflineRouting loads the local nodes private key and
// uses it to instantiate a routing system in offline mode.
// This is primarily used for offline ipns modifications.
func
(
n
*
IpfsNode
)
SetupOfflineRouting
()
error
{
err
:=
n
.
loadPrivateKey
()
if
err
!=
nil
{
...
...
fuse/ipns/ipns_unix.go
浏览文件 @
a5233fae
...
...
@@ -33,6 +33,8 @@ var (
longRepublishTimeout
=
time
.
Millisecond
*
500
)
// InitializeKeyspace sets the ipns record for the given key to
// point to an empty directory.
func
InitializeKeyspace
(
n
*
core
.
IpfsNode
,
key
ci
.
PrivKey
)
error
{
emptyDir
:=
&
mdag
.
Node
{
Data
:
ft
.
FolderPBData
()}
k
,
err
:=
n
.
DAG
.
Add
(
emptyDir
)
...
...
routing/dht/dht.go
浏览文件 @
a5233fae
...
...
@@ -235,6 +235,8 @@ func (dht *IpfsDHT) getLocal(key u.Key) ([]byte, error) {
return
rec
.
GetValue
(),
nil
}
// getOwnPrivateKey attempts to load the local peers private
// key from the peerstore.
func
(
dht
*
IpfsDHT
)
getOwnPrivateKey
()
(
ci
.
PrivKey
,
error
)
{
sk
:=
dht
.
peerstore
.
PrivKey
(
dht
.
self
)
if
sk
==
nil
{
...
...
routing/dht/records.go
浏览文件 @
a5233fae
...
...
@@ -42,7 +42,7 @@ func RecordBlobForSig(r *pb.Record) []byte {
return
bytes
.
Join
([][]
byte
{
k
,
v
,
a
},
[]
byte
{})
}
// creates and signs a dht record for the given key/value pair
//
MakePutRecord
creates and signs a dht record for the given key/value pair
func
MakePutRecord
(
sk
ci
.
PrivKey
,
key
u
.
Key
,
value
[]
byte
)
(
*
pb
.
Record
,
error
)
{
record
:=
new
(
pb
.
Record
)
...
...
@@ -175,6 +175,8 @@ func (dht *IpfsDHT) verifyRecordOnline(ctx context.Context, r *pb.Record) error
return
dht
.
verifyRecord
(
r
,
pk
)
}
// TODO: make this an independent exported function.
// it might be useful for users to have access to.
func
(
dht
*
IpfsDHT
)
verifyRecord
(
r
*
pb
.
Record
,
pk
ci
.
PubKey
)
error
{
// First, validate the signature
blob
:=
RecordBlobForSig
(
r
)
...
...
routing/offline/offline.go
浏览文件 @
a5233fae
...
...
@@ -27,6 +27,9 @@ func NewOfflineRouter(dstore ds.Datastore, privkey ci.PrivKey) routing.IpfsRouti
}
}
// offlineRouting implements the IpfsRouting interface,
// but only provides the capability to Put and Get signed dht
// records to and from the local datastore.
type
offlineRouting
struct
{
datastore
ds
.
Datastore
sk
ci
.
PrivKey
...
...
@@ -86,4 +89,5 @@ func (c *offlineRouting) Ping(ctx context.Context, p peer.ID) (time.Duration, er
return
0
,
ErrOffline
}
// ensure offlineRouting matches the IpfsRouting interface
var
_
routing
.
IpfsRouting
=
&
offlineRouting
{}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论