mirror of
https://github.com/amark/gun.git
synced 2025-06-06 22:26:48 +00:00
Merge branch 'master' into manhattan
This commit is contained in:
commit
e98e51a0ea
32
README.md
32
README.md
@ -9,7 +9,7 @@
|
||||
|
||||
Currently, [Internet Archive](https://news.ycombinator.com/item?id=17685682) and HackerNoon run GUN in production.
|
||||
|
||||
Decentralized alternatives to [Reddit](https://notabug.io/t/whatever/comments/36588a16b9008da4e3f15663c2225e949eca4a15/gpu-bot-test), [YouTube](https://d.tube/), [Wikipedia](https://news.ycombinator.com/item?id=17685682), etc. are already pushing terabytes of daily P2P traffic on GUN. We are a [friendly community](https://gitter.im/amark/gun) creating a free fun future for freedom:
|
||||
Decentralized alternatives to [Reddit](https://notabug.io/t/whatever/comments/36588a16b9008da4e3f15663c2225e949eca4a15/gpu-bot-test), [YouTube](https://d.tube/), [Wikipedia](https://news.ycombinator.com/item?id=17685682), etc. have already pushed terabytes of daily P2P traffic on GUN. We are a [friendly community](https://gitter.im/amark/gun) creating a free fun future for freedom:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@ -186,28 +186,24 @@ rm -rf *data*
|
||||
|
||||
### Additional Cryptography Libraries
|
||||
|
||||
To install with npm, first install `npm install gun -S`.
|
||||
For just the networking layer, import Gun:
|
||||
> These are only needed for NodeJS, they shim the native Browser WebCrypto API.
|
||||
|
||||
If you want to use [SEA](https://gun.eco/docs/SEA) for `User` auth and security, you will need to install:
|
||||
|
||||
`npm install text-encoding isomorphic-webcrypto --save`
|
||||
|
||||
Then you can require [SEA](https://gun.eco/docs/SEA) without an error:
|
||||
|
||||
```javascript
|
||||
var Gun = require('gun/gun');
|
||||
var GUN = require('gun/gun');
|
||||
var SEA = require('gun/sea');
|
||||
```
|
||||
|
||||
If you also need to install SEA for user auth and crypto, also install some of its dependencies like this:
|
||||
|
||||
`npm install text-encoding @peculiar/webcrypto --save`
|
||||
|
||||
You will need to require it too (it will be automatically added to the Gun object):
|
||||
|
||||
```javascript
|
||||
var Gun = require('gun/gun');
|
||||
var Sea = require('gun/sea');
|
||||
```
|
||||
|
||||
|
||||
## Deploy
|
||||
|
||||
To quickly spin up a Gun test server for your development team, utilize either [Heroku](http://heroku.com) or [Docker](http://docker.com) or any variant thereof [Dokku](http://dokku.viewdocs.io/dokku/), [Flynn.io](http://flynn.io), [now.sh](https://zeit.co/now), etc. !
|
||||
> Note: The default examples that get auto-deployed on `npm start` CDN-ify all GUN files, modules, & storage.
|
||||
|
||||
To quickly spin up a GUN relay peer for your development team, utilize either [Heroku](http://heroku.com), [Docker](http://docker.com), any variant thereof [Dokku](http://dokku.viewdocs.io/dokku/), [Flynn.io](http://flynn.io), [now.sh](https://zeit.co/now), etc. ! Or use all of them so your relays are decentralized too!
|
||||
|
||||
### [Heroku](https://www.heroku.com/)
|
||||
|
||||
@ -244,6 +240,8 @@ Then visit the deployed app by following the 'view app' button, in your browser.
|
||||
|
||||
### [Docker](https://www.docker.com/)
|
||||
|
||||
> Warning: Docker image is community contributed and may be old with missing security updates, please check version numbers to compare.
|
||||
|
||||
[](https://hub.docker.com/r/gundb/gun/) [](https://microbadger.com/images/gundb/gun "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/gundb/gun/) [](https://hub.docker.com/r/gundb/gun/)
|
||||
|
||||
Pull from the [Docker Hub](https://hub.docker.com/r/gundb/gun/) [](https://microbadger.com/images/gundb/gun). Or:
|
||||
|
@ -6,6 +6,7 @@
|
||||
# Copy paste and run each line into your terminal.
|
||||
# If you are on Windows, http://nodejs.org/download/ has
|
||||
# an installer that will automatically do it for you.
|
||||
# curl -o- https://raw.githubusercontent.com/amark/gun/master/examples/install.sh | bash
|
||||
|
||||
#debian/ubuntu
|
||||
su -
|
||||
|
@ -22,11 +22,10 @@ Gun.on('create', function(root){
|
||||
socket.bind({port: udp.port, exclusive: true}, function(){
|
||||
socket.setBroadcast(true);
|
||||
socket.setMulticastTTL(128);
|
||||
try{ socket.addMembership(udp.address); }catch(e){}
|
||||
});
|
||||
|
||||
socket.on("listening", function(){
|
||||
try { socket.addMembership(udp.address) }catch(e){ return }
|
||||
try { socket.addMembership(udp.address) }catch(e){ console.error(e); return; }
|
||||
udp.peer = {id: udp.address + ':' + udp.port, wire: socket};
|
||||
|
||||
udp.peer.say = function(raw){
|
||||
|
@ -21,13 +21,16 @@
|
||||
opt.RTCSessionDescription = rtcsd;
|
||||
opt.RTCIceCandidate = rtcic;
|
||||
opt.rtc = opt.rtc || {'iceServers': [
|
||||
{url: 'stun:stun.l.google.com:19302'},
|
||||
{url: "stun:stun.sipgate.net:3478"},
|
||||
{url: "stun:stun.stunprotocol.org"},
|
||||
{url: "stun:stun.sipgate.net:10000"},
|
||||
{url: "stun:217.10.68.152:10000"},
|
||||
{url: 'stun:stun.services.mozilla.com'}
|
||||
{urls: 'stun:stun.l.google.com:19302'},
|
||||
{urls: "stun:stun.sipgate.net:3478"}/*,
|
||||
{urls: "stun:stun.stunprotocol.org"},
|
||||
{urls: "stun:stun.sipgate.net:10000"},
|
||||
{urls: "stun:217.10.68.152:10000"},
|
||||
{urls: 'stun:stun.services.mozilla.com'}*/
|
||||
]};
|
||||
// TODO: Select the most appropriate stuns.
|
||||
// FIXME: Find the wire throwing ICE Failed
|
||||
// The above change corrects at least firefox RTC Peer handler where it **throws** on over 6 ice servers, and updates url: to urls: removing deprecation warning
|
||||
opt.rtc.dataChannel = opt.rtc.dataChannel || {ordered: false, maxRetransmits: 2};
|
||||
opt.rtc.sdp = opt.rtc.sdp || {mandatory: {OfferToReceiveAudio: false, OfferToReceiveVideo: false}};
|
||||
opt.announce = function(to){
|
||||
|
@ -367,6 +367,43 @@ var names = ["Adalard","Adora","Aia","Albertina","Alfie","Allyn","Amabil","Ammam
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('read contacts smaller than cursor', function(done){ // TODO!!!
|
||||
var all = {}, cursor = 'm', to;
|
||||
names.forEach(function(v){
|
||||
v = v.toLowerCase();
|
||||
if(v < cursor){ all[v] = true }
|
||||
});
|
||||
gun.get('names').get({'.': {'<': cursor}, '%': 1000 * 100}).once().map().once(function(data, key){
|
||||
expect(data.name).to.be.ok();
|
||||
expect(data.age).to.be.ok();
|
||||
//if(!all.hasOwnProperty(key)){console.error(key);}
|
||||
expect(all.hasOwnProperty(key)).to.be.ok();
|
||||
delete all[key];
|
||||
clearTimeout(to);
|
||||
to = setTimeout(function(){
|
||||
expect(Gun.obj.empty(all)).to.be.ok();
|
||||
done();
|
||||
},100);
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('read contacts in descending order', function(done){ // TODO!!!
|
||||
var all = {}, cursor = 'm', to;
|
||||
names.forEach(function(v){
|
||||
all[v] = true;
|
||||
});
|
||||
gun.get('names').get({'.': {'-': true}, '%': 1000 * 100}).once().map().once(function(data, key){
|
||||
expect(data.name).to.be.ok();
|
||||
expect(data.age).to.be.ok();
|
||||
delete all[key];
|
||||
clearTimeout(to);
|
||||
to = setTimeout(function(){
|
||||
expect(Gun.obj.empty(all)).to.be.ok();
|
||||
done();
|
||||
},100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user