Skip to content

Commit

Permalink
Manifest store (#185)
Browse files Browse the repository at this point in the history
* Added ipni to go-mobile

* removed ipniPublish from put and added as an interface

* Added DHT to exchange
  • Loading branch information
ehsan6sha authored Nov 24, 2023
1 parent fdfac45 commit c0ce3d0
Show file tree
Hide file tree
Showing 13 changed files with 1,206 additions and 19 deletions.
18 changes: 18 additions & 0 deletions blox/blox.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,24 @@ func (p *Blox) AnnounceJoinPoolRequestPeriodically(ctx context.Context) {
go p.an.AnnounceJoinPoolRequestPeriodically(ctx)
}

func (p *Blox) ProvideLinkByDht(l ipld.Link) error {
//This is for unit testing and no need to call directly
log.Debug("ProvideLinkByDht test")
return p.ex.ProvideDht(l)
}

func (p *Blox) FindLinkProvidersByDht(l ipld.Link) ([]peer.AddrInfo, error) {
//This is for unit testing and no need to call directly
log.Debug("FindLinkProvidersByDht test")
return p.ex.FindProvidersDht(l)
}

func (p *Blox) UpdateDhtPeers(peers []peer.ID) error {
//This is for unit testing and no need to call directly
log.Debug("UpdateDhtPeers test")
return p.ex.UpdateDhtPeers(peers)
}

func (p *Blox) Shutdown(ctx context.Context) error {
log.Info("Shutdown in progress")

Expand Down
11 changes: 10 additions & 1 deletion cmd/blox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import (
logging "github.com/ipfs/go-log/v2"
"github.com/ipni/index-provider/engine"
"github.com/libp2p/go-libp2p"
dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/p2p/host/autorelay"
"github.com/mdp/qrterminal"
"github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -145,7 +147,7 @@ func init() {
Name: "ipniPublishDirectAnnounce",
Usage: "The list of IPNI URLs to which make direct announcements.",
Destination: &app.config.directAnnounce,
Value: cli.NewStringSlice("https://cid.contact/ingest/announce"),
Value: cli.NewStringSlice("https://announce.relay2.functionyard.fula.network/ingest/announce"),
}),
altsrc.NewStringFlag(&cli.StringFlag{
Name: "ipniPublisherIdentity",
Expand Down Expand Up @@ -489,6 +491,13 @@ func action(ctx *cli.Context) error {
engine.WithPublisherKind(engine.DataTransferPublisher),
engine.WithDirectAnnounce(app.config.IpniPublishDirectAnnounce...),
),
exchange.WithDhtProviderOptions(
dht.Datastore(namespace.Wrap(ds, datastore.NewKey("dht"))),
dht.ProtocolExtension(protocol.ID("/"+app.config.PoolName)),
dht.ProtocolPrefix("/fula"),
dht.Resiliency(1),
dht.Mode(dht.ModeAutoServer),
),
),
)
if err != nil {
Expand Down
Loading

0 comments on commit c0ce3d0

Please sign in to comment.