https://github.com/ipfs/go-ipfs-provider
https://github.com/ipfs/go-ipfs-provider
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ipfs/go-ipfs-provider
- Owner: ipfs
- License: other
- Archived: true
- Created: 2018-08-30T23:59:30.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T11:15:19.000Z (almost 3 years ago)
- Last Synced: 2025-01-19T15:45:21.773Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 248 KB
- Stars: 17
- Watchers: 21
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# go-ipfs-provider
[](https://protocol.ai)
[](http://ipfs.io/)
[](http://webchat.freenode.net/?channels=%23ipfs)
[](https://codecov.io/gh/ipfs/go-ipfs-provider)
[](https://travis-ci.org/ipfs/go-ipfs-provider)
## ❗ This repo is no longer maintained.
👉 We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/provider.
🏎️ Good news! There is [tooling and documentation](https://github.com/ipfs/boxo#migrating-to-boxo) to expedite a switch in your repo.
⚠️ If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).
📚 Learn more, including how to take the maintainership mantle or ask questions, [here](https://github.com/ipfs/boxo/wiki/Copied-or-Migrated-Repos-FAQ).
## Background
The provider system is responsible for announcing and reannouncing to the ipfs network that a node has content.
## Install
Via `go get`:
```sh
$ go get github.com/ipfs/go-ipfs-provider
```
> Requires Go 1.12
## Usage
Here's how you create, start, interact with, and stop the provider system:
```golang
import (
"context"
"time"
"github.com/ipfs/go-ipfs-provider"
"github.com/ipfs/go-ipfs-provider/queue"
"github.com/ipfs/go-ipfs-provider/simple"
)
rsys := (your routing system here)
dstore := (your datastore here)
cid := (your cid to provide here)
q := queue.NewQueue(context.Background(), "example", dstore)
reprov := simple.NewReprovider(context.Background(), time.Hour * 12, rsys, simple.NewBlockstoreProvider(dstore))
prov := simple.NewProvider(context.Background(), q, rsys)
sys := provider.NewSystem(prov, reprov)
sys.Run()
sys.Provide(cid)
sys.Close()
```
## License
This library is dual-licensed under Apache 2.0 and MIT terms.
Copyright 2019. Protocol Labs, Inc.