mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
finish addressing PR concerns
This commit is contained in:
@ -35,12 +35,11 @@ func NewDagReader(n *mdag.Node, serv mdag.DAGService) (io.Reader, error) {
|
||||
// Dont allow reading directories
|
||||
return nil, ErrIsDir
|
||||
case ftpb.Data_File:
|
||||
dr := &DagReader{
|
||||
return &DagReader{
|
||||
node: n,
|
||||
serv: serv,
|
||||
buf: bytes.NewBuffer(pb.GetData()),
|
||||
}
|
||||
return dr, nil
|
||||
}, nil
|
||||
case ftpb.Data_Raw:
|
||||
// Raw block will just be a single level, return a byte buffer
|
||||
return bytes.NewBuffer(pb.GetData()), nil
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
|
||||
bsrv "github.com/jbenet/go-ipfs/blockservice"
|
||||
dag "github.com/jbenet/go-ipfs/merkledag"
|
||||
u "github.com/jbenet/go-ipfs/util"
|
||||
)
|
||||
|
||||
func GetDAGServ(t testing.TB) dag.DAGService {
|
||||
@ -21,7 +22,8 @@ func GetDAGServ(t testing.TB) dag.DAGService {
|
||||
}
|
||||
|
||||
func RandPeer() peer.Peer {
|
||||
id := make(peer.ID, 16)
|
||||
id := make([]byte, 16)
|
||||
crand.Read(id)
|
||||
return peer.WithID(id)
|
||||
}
|
||||
mhid := u.Hash(id)
|
||||
return peer.WithID(peer.ID(mhid))
|
||||
}
|
||||
|
Reference in New Issue
Block a user