Skip to content

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

@gmaclennan

Description

@gmaclennan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions