Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
c1412339
提交
c1412339
authored
9月 14, 2014
作者:
Juan Batiz-Benet
提交者:
Brian Tiger Chow
9月 22, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
starting to integrate new net
上级
f71be6e9
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
18 行增加
和
16 行删除
+18
-16
message.go
bitswap/message.go
+1
-1
core.go
core/core.go
+12
-6
dht.go
routing/dht/dht.go
+2
-6
dht_test.go
routing/dht/dht_test.go
+3
-3
没有找到文件。
bitswap/message.go
浏览文件 @
c1412339
...
...
@@ -2,8 +2,8 @@ package bitswap
import
(
blocks
"github.com/jbenet/go-ipfs/blocks"
swarm
"github.com/jbenet/go-ipfs/net/swarm"
peer
"github.com/jbenet/go-ipfs/peer"
swarm
"github.com/jbenet/go-ipfs/swarm"
u
"github.com/jbenet/go-ipfs/util"
)
...
...
core/core.go
浏览文件 @
c1412339
...
...
@@ -5,15 +5,18 @@ import (
"errors"
"fmt"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
b58
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
"github.com/jbenet/go-ipfs/bitswap"
bitswap
"github.com/jbenet/go-ipfs/bitswap"
bserv
"github.com/jbenet/go-ipfs/blockservice"
config
"github.com/jbenet/go-ipfs/config"
ci
"github.com/jbenet/go-ipfs/crypto"
merkledag
"github.com/jbenet/go-ipfs/merkledag"
swarm
"github.com/jbenet/go-ipfs/net/swarm"
inet
"github.com/jbenet/go-ipfs/net"
mux
"github.com/jbenet/go-ipfs/net/mux"
path
"github.com/jbenet/go-ipfs/path"
peer
"github.com/jbenet/go-ipfs/peer"
routing
"github.com/jbenet/go-ipfs/routing"
...
...
@@ -37,7 +40,7 @@ type IpfsNode struct {
Datastore
ds
.
Datastore
// the network message stream
Swarm
*
swarm
.
Swarm
Network
inet
.
Network
// the routing system. recommend ipfs-dht
Routing
routing
.
IpfsRouting
...
...
@@ -75,15 +78,18 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
}
var
(
net
*
swarm
.
Swarm
net
*
inet
.
Network
// TODO: refactor so we can use IpfsRouting interface instead of being DHT-specific
route
*
dht
.
IpfsDHT
swap
*
bitswap
.
BitSwap
)
if
online
{
net
=
swarm
.
NewSwarm
(
local
)
err
=
net
.
Listen
()
// add protocol services here.
net
,
err
:=
inet
.
NewIpfsNetwork
(
context
.
TODO
(),
local
,
&
mux
.
ProtocolMap
{
// "1": dhtService,
// "2": bitswapService,
})
if
err
!=
nil
{
return
nil
,
err
}
...
...
routing/dht/dht.go
浏览文件 @
c1412339
...
...
@@ -7,7 +7,7 @@ import (
"sync"
"time"
swarm
"github.com/jbenet/go-ipfs/net/swarm
"
inet
"github.com/jbenet/go-ipfs/net
"
peer
"github.com/jbenet/go-ipfs/peer"
kb
"github.com/jbenet/go-ipfs/routing/kbucket"
u
"github.com/jbenet/go-ipfs/util"
...
...
@@ -28,8 +28,7 @@ type IpfsDHT struct {
// NOTE: (currently, only a single table is used)
routingTables
[]
*
kb
.
RoutingTable
network
swarm
.
Network
netChan
*
swarm
.
Chan
network
inet
.
Network
// Local peer (yourself)
self
*
peer
.
Peer
...
...
@@ -48,9 +47,6 @@ type IpfsDHT struct {
//lock to make diagnostics work better
diaglock
sync
.
Mutex
// listener is a server to register to listen for responses to messages
listener
*
swarm
.
MessageListener
}
// NewDHT creates a new DHT object with the given peer as the 'local' host
...
...
routing/dht/dht_test.go
浏览文件 @
c1412339
...
...
@@ -6,7 +6,7 @@ import (
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
ci
"github.com/jbenet/go-ipfs/crypto"
identify
"github.com/jbenet/go-ipfs/identify
"
spipe
"github.com/jbenet/go-ipfs/crypto/spipe
"
swarm
"github.com/jbenet/go-ipfs/net/swarm"
peer
"github.com/jbenet/go-ipfs/peer"
u
"github.com/jbenet/go-ipfs/util"
...
...
@@ -36,7 +36,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
}
p
.
PubKey
=
pk
p
.
PrivKey
=
sk
id
,
err
:=
identify
.
IDFromPubKey
(
pk
)
id
,
err
:=
spipe
.
IDFromPubKey
(
pk
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
@@ -68,7 +68,7 @@ func makePeer(addr *ma.Multiaddr) *peer.Peer {
}
p
.
PrivKey
=
sk
p
.
PubKey
=
pk
id
,
err
:=
identify
.
IDFromPubKey
(
pk
)
id
,
err
:=
spipe
.
IDFromPubKey
(
pk
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论