Skip to content

Commit

Permalink
fix: ipfs config on disable network
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jan 24, 2022
1 parent 859537b commit 667e55d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions go/internal/initutil/ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (m *Manager) getLocalIPFS() (ipfsutil.ExtendedCoreAPI, *ipfs_core.IpfsNode,
}

var routing ipfs_p2p.RoutingOption
if dhtmode > 0 {
if dhtmode > 0 && !m.Node.Protocol.DisableIPFSNetwork {
dhtopts := []p2p_dht.Option{p2p_dht.Concurrency(2)}
if m.Node.Protocol.DHTRandomWalk {
dhtopts = append(dhtopts, p2p_dht.DisableAutoRefresh())
Expand All @@ -188,10 +188,6 @@ func (m *Manager) getLocalIPFS() (ipfsutil.ExtendedCoreAPI, *ipfs_core.IpfsNode,
IpfsConfigPatch: m.setupIPFSConfig,
RoutingConfigFunc: m.configIPFSRouting,
RoutingOption: routing,
ExtraOpts: map[string]bool{
// @NOTE(gfanton) temporally disable ipfs *main* pubsub
"pubsub": false,
},
}

if m.Node.Protocol.MDNS.Enable && m.Node.Protocol.MDNS.DriverLocker != nil {
Expand Down Expand Up @@ -410,6 +406,15 @@ func (m *Manager) setupIPFSConfig(cfg *ipfs_cfg.Config) ([]libp2p.Option, error)
cfg.Swarm.Transports.Network.TCP = ipfs_cfg.False
cfg.Swarm.Transports.Network.Websocket = ipfs_cfg.False

// disable bootstrap
cfg.Bootstrap = []string{}

// disable most services
cfg.AutoNAT.ServiceMode = ipfs_cfg.AutoNATServiceDisabled
cfg.Pubsub.Enabled = ipfs_cfg.False
cfg.Swarm.RelayClient.Enabled = ipfs_cfg.False
cfg.Swarm.RelayService.Enabled = ipfs_cfg.False

// Disable MDNS
cfg.Discovery.MDNS.Enabled = false

Expand Down Expand Up @@ -488,6 +493,9 @@ func (m *Manager) setupIPFSConfig(cfg *ipfs_cfg.Config) ([]libp2p.Option, error)
cfg.Peering.Peers = append(cfg.Peering.Peers, *p)
}

// disable main ipfs pubsub
cfg.Pubsub.Enabled = ipfs_cfg.False

return p2popts, nil
}

Expand Down

0 comments on commit 667e55d

Please sign in to comment.