mirror of https://github.com/kern/filepizza
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
888 B
JavaScript
38 lines
888 B
JavaScript
import uuid from 'node-uuid'
|
|
|
|
const id = uuid.v4()
|
|
|
|
if (typeof window === 'undefined') {
|
|
var peer = { id: id }
|
|
} else {
|
|
let Peer = require('peerjs')
|
|
var peer = new Peer(id, {
|
|
host: window.location.hostname,
|
|
port: window.location.port,
|
|
path: '/peer',
|
|
config: {
|
|
iceServers: [{
|
|
'url': 'stun:stun.l.google.com:19302'
|
|
}, {
|
|
'url': 'turn:52.12.205.113:3478?transport=udp',
|
|
'username': 'file',
|
|
'credential': 'pizza'
|
|
}, {
|
|
'url': 'turn:52.12.205.113:80?transport=udp',
|
|
'username': 'file',
|
|
'credential': 'pizza'
|
|
}, {
|
|
'url': 'turn:52.12.205.113:3478?transport=tcp',
|
|
'username': 'file',
|
|
'credential': 'pizza'
|
|
}, {
|
|
'url': 'turn:52.12.205.113:80?transport=tcp',
|
|
'username': 'file',
|
|
'credential': 'pizza'
|
|
}]
|
|
}
|
|
})
|
|
}
|
|
|
|
export default peer
|