Copying a bit what I already sent to Protocol Labs and wrote on github, thanks to move this to the right category if this is not the relevant one, I am restricted to two links apparently so please forgive the format
Please see this discussion: https://github.com/ipfs/ipfs/issues/439 that summarizes the proposal
This works also for piping non nodejs/js modules (for example bitcoin), please see the general documentation here (maybe good to start by reading that one first): https://github.com/Ayms/node-Tor#forking-node-tor (technical one is here: github com Ayms node-Tor tree master docs)
As stated in the above thread it is not a remake of the Tor network and should not be misunderstood with it, this is an implementation of the Tor protocol inside nodes and browsers that can be customized according to the needs/level of security required (peer discovery, number of hops, rdv points or direct p2p, etc) not following necessarilly the centralized Tor network principles
Next to come is elliptic crypto and WebRTC
And then next can be to design and integrate the IPFS anonymous system using node-Tor (proposed name: IPTSā¦)
And/or whatever protocol, to give an example any protocol implements somewhere in a central place something like:
socket is a network socket
socket.on(ādataā,//process data)
socket.send=//send data
to pipe with node-Tor, just modify by something like:
substitute the network socket by whatever object you like, it remains compatible with the rest of the code
piping(socket)
socket._write_b=//process data
socket.send=function(data) {this._stream_f.push(data)} //will send data to the tor protocol
socket.pipe(node_Tor)
You can chain pipes of course
This is simple (a bit simplified here, usually there is a handshake and/or other things, the pipe method handles events, but you see how it works and the changes are really a few lines of code), what is not is the specific design to use the Tor protocol according to the projects, here IPFS