mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
don't load identity in offline mode (temp)
**For now**, we don't need to load/parse the private key (which causes a signficant delay in commands) when doing things entirely offline. This may change, and in that case the private key should be loaded on demand.
This commit is contained in:
13
core/core.go
13
core/core.go
@ -74,11 +74,6 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
local, err := initIdentity(cfg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
peerstore := peer.NewPeerstore()
|
peerstore := peer.NewPeerstore()
|
||||||
|
|
||||||
// FIXME(brian): This is a bit dangerous. If any of the vars declared in
|
// FIXME(brian): This is a bit dangerous. If any of the vars declared in
|
||||||
@ -90,12 +85,20 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
|
|||||||
// TODO: refactor so we can use IpfsRouting interface instead of being DHT-specific
|
// TODO: refactor so we can use IpfsRouting interface instead of being DHT-specific
|
||||||
route *dht.IpfsDHT
|
route *dht.IpfsDHT
|
||||||
exchangeSession exchange.Interface
|
exchangeSession exchange.Interface
|
||||||
|
local *peer.Peer
|
||||||
)
|
)
|
||||||
|
|
||||||
if online {
|
if online {
|
||||||
// add protocol services here.
|
// add protocol services here.
|
||||||
ctx := context.TODO() // derive this from a higher context.
|
ctx := context.TODO() // derive this from a higher context.
|
||||||
|
|
||||||
|
// when not online, don't need to parse private keys (yet)
|
||||||
|
local, err := initIdentity(cfg)
|
||||||
|
if err != nil {
|
||||||
|
cancel()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
dhtService := netservice.NewService(nil) // nil handler for now, need to patch it
|
dhtService := netservice.NewService(nil) // nil handler for now, need to patch it
|
||||||
exchangeService := netservice.NewService(nil) // nil handler for now, need to patch it
|
exchangeService := netservice.NewService(nil) // nil handler for now, need to patch it
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user