holepunchto / holepunchto/hypercore

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

Open
#555 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.9k
Forks
211
Avg merge
5h 49m
Merged PRs (30d)
9

Description

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 https://github.com/holepunchto/hypercore/issues/305, which I think can be closed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the proof-of-concept changes in pull request 499 and the related issue 305 first. Define the default and per-peer uploading and downloading controls described here, including the three use cases and the proposed peer methods. Done should provide independently controllable upload and download behavior for each peer and configurable defaults for new peers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.