Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add per-peer control over uploading and downloading #555

Open
gmaclennan opened this issue Aug 29, 2024 · 0 comments
Open

Comments

@gmaclennan
Copy link
Contributor

This is a request to control whether a core is uploading or downloading on a per-peer basis.

Use case 1: User is on a metered internet connection (e.g. with bandwidth costs) and is connected to both local (same wifi network) and remote peers. User might want to only replicate in one direction (e.g. upload or download) with the remote peer.

Use case 2: User wants control over replicating data, but wants to know what data is available to replicate before deciding to download it. E.g. user wants to know the updated length of the core from a peer before deciding to download it.

Use case 3: With an authorization layer, a user might want to download data from a peer, but not allow uploads to that peer, e.g. for a peer that has authorization removed but still has important data that needs replicated.

It would be helpful to set a default for new peers, and add methods to control this for each peer, e.g.

const core = new Hypercore({ uploading: false, downloading: false })
core.on('peer-add', peer => {
  peer.setUploading(true)
  peer.setDownloading(true)
})

See https://github.com/holepunchto/hypercore/pull/499/files for a proof-of-concept naive implementation.

This issue supercedes #305, which I think can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant