Closed neuronsupport closed 5 years ago
Hello @norzak. Yes the build is very large. Webtorrent is a significant proportion of the build size - 326K
out of 574K
. It would be possible for Bugout to work without Webtorrent but it would be a significant coding effort. At the moment Bugout uses the Webtorrent tracker/signalling servers to allow clients to find each other and building on top of it meant the development time was faster.
The NaCl signing & encryption is 100% necessary to the safe functioning of this software. It is what allows you to know with some certainty that the source of data came from the node you think it did and has not been tampered with in transit. In Bugout sometimes data will be sent via an intermediary and if there was no signing or encryption you could not be sure a man-in-the-middle had not modified the packets.
If you don't need these features of Bugout you might be interested in https://github.com/feross/simple-peer which will allow you to build your own WebRTC based systems.
I would merge a pull request which made Bugout work without Webtorrent if it continued to work with the same signalling servers.
Hello. I didnt mean to make it work without webtorrent. Just leave it out of the build so that we can explicitly provide our own webtorrent instance to the bugout. We already have webtorrent in our library build.
If it is a plain communication of some nonsensical data, man in the middle attacks would not be a problem to those ends. Anyways, thanks for the effort and sharing it.
@norzak Yes for sure, I could make a separate build with no Webtorrent bundled. Note that you should be able to also just require('bugout');
and your library build should only include Webtorrent once.
Unfortunately, our build tool is not that smart :). Thank you, that would be awesome to make a separate build.
@norzak I just did some profiling and discovered that the base58check
module also adds a whopping 244k
(minified) to the build. It basically adds the same amount as WebTorrent. :man_facepalming: This is way too big. I am re-opening this to investigate.
I can help with your other build issues if you email me.
Build sizes with different parts excluded:
612k
= default size.368k
= no webtorrent.368k
= no base58check.120K
= no webtorrent or base58check.I tested the other dependencies but they all came in under 20k
each.
I created a simple test for the size of base58check minified:
var bs58check = require('base58check');
console.log(bs58check.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr'));
$ ./node_modules/.bin/browserify -s size size.js | ./node_modules/.bin/minify > size.min.js && du -h size.min.js
320K size.min.js
This is madness. Will fix.
It is safe to say that using something other than bs58check would make much more sense. 320K is plain extraterrestrial.
Hi @norzak. Good news, I've managed to reduce the build size by 227k
by swapping out the old base58check
library for the newer bs58check
library and also upgrading browserify
and babel-minify
seems to have helped.
If you want to make your own minified build without webtorrent you can do this from the Bugout checkout:
./node_modules/.bin/browserify -s Bugout --exclude webtorrent index.js | ./node_modules/.bin/minify > bugout-no-webtorrent.min.js && du -h bugout-no-webtorrent.min.js
Note that I am currently manually bundling this fix from simple-peer until it makes it into webtorrent:
https://github.com/feross/simple-peer/pull/353
Without this fix Bugout will take up to a minute to connect on certain networks.
Wow, it has been a month, and they(or may be one person) still didnt merge this to simple-peer. In that case, It may make more sense to just use your build with webtorrent and dump our standalone inclusion of webtorrent. I will see what we can do on our end. thanks for your relentless effort.
@norzak oh by the way you can get access to the WebTorrent
object built inside of Bugout
like this: bugout.prototype.WebTorrent()
.
Is it possible to offer an option to turn off the encryption because we need raw performance in one form of peer communication we use where security is not really a concern. It may be an option for the BugOut constructor.
@norzak if your message is not sent to a specific peer then it is unencrypted. It is still signed. If you want to send an unsigned message you could call send directly on the underlying simple-peer object which you can find on torrent.wires
.
Do you think it is possible to support Video/Audio chat using WebTorrent infrastructure?
@norzak yes the simple-peer
channel supports audio/video so I guess it should be possible. I have no clue about how to do that though!
I think feross/simple-peer#353 is recently merged.
Size of the minimized build is very big compare to what is done.How big I wonder the build would be if it does not include webtorrent library itself (making wt option mandatory), and all those enscription/singning libraries that we would not need?