P2p
Protocols
Ping
We have the implementation of a basic ping protocol. This is not actually used within Spacedrive but acts a reference for implementing a new protocol.
Spacedrop
Spacedrop is a system for sending files quickly to other peers. It is intended for sending to peers that have not been paired into the library. It is great for sending a file to a friend on your same network running Spacedrive but you can use the regular file manager for sharing a file without another node in your library.
This protocol works but some of the following are missing features:
- Pause/resumable transfers
- Transfer a folder - ENG-1297
- Usage with
sd-server
will result in bugs if you have multiple web clients - ENG-1034 and ENG-1522
The following are known bugs:
rspc
This protocol was an experiment to expose the rspc router of a node over P2P. Although it works this is a security nightmare so it has been disabled by default and hidden behind the wipP2P
feature flag.
How to test this feature:
- Enable the
wipP2P
feature flag - Enable the feature within the network page of settings
- Ensure "Enable remote acccess" is enabled on both nodes
- Click the "rspc remote" button on the node you want to connect to.
- If the connection fails you will be presented with a white screen, otherwise you will be given a library selection and once seleted you will be given Spacedrive UI running on the remote node.
Major problems with this feature:
- This protocol doesn't have any security (hence it being disabled by default). It's also a nightmare to secure as it's full access (including to do filesystem actions) or no access. - ENG-1646
- The rspc websocket connection established over the P2P system is leaked so it will never be cleaned up. Fixing this would require changes to rspc. - ENG-1647
- Any usage of rspc outside the React context will still be using the local node's rspc router. We don't do this often but we definitely do it. - ENG-1648
From my (oscartbeaumont's) perspective this was a cool experiment but not something we should ship because getting it's nightmare to get security right.
Sync
Unimplemented
In an earlier version of the P2P system we had a method for sending sync messages to other nodes over the peer to peer connection, however this was removed during some refactoring of the sync system.
The code for it could be taken from here and upgraded to account for changes to the sync and P2P system to bring back this functionality.
Loading remote files
TODO - Loading file within location over P2P
Sync preview media
https://linear.app/spacedriveapp/issue/ENG-910/sync-preview-media