(ctx context.Context, mn mocknet.Mocknet)
| 83 | } |
| 84 | |
| 85 | func MockPublicNode(ctx context.Context, mn mocknet.Mocknet) (*core.IpfsNode, error) { |
| 86 | ds := syncds.MutexWrap(datastore.NewMapDatastore()) |
| 87 | cfg, err := config.Init(io.Discard, 2048) |
| 88 | if err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | count := len(mn.Peers()) |
| 92 | cfg.Addresses.Swarm = []string{ |
| 93 | fmt.Sprintf("/ip4/18.0.%d.%d/tcp/4001", count>>16, count&0xFF), |
| 94 | } |
| 95 | cfg.Datastore = config.Datastore{} |
| 96 | return core.NewNode(ctx, &core.BuildCfg{ |
| 97 | Online: true, |
| 98 | Routing: libp2p2.DHTServerOption, |
| 99 | Repo: &repo.Mock{ |
| 100 | C: *cfg, |
| 101 | D: ds, |
| 102 | }, |
| 103 | Host: MockHostOption(mn), |
| 104 | }) |
| 105 | } |
nothing calls this directly
no test coverage detected