update P2P Server list for dev branch

cron-addstorage-fix
Moe 2021-11-18 19:48:13 -08:00
parent 61c99bfc7f
commit 9648f8cc60
1 changed files with 64 additions and 73 deletions

View File

@ -1,10 +1,20 @@
const { Worker } = require('worker_threads');
module.exports = function(s,config,lang,app){
const fetch = require('node-fetch')
const { modifyConfiguration, getConfiguration } = require('./system/utils.js')(config)
let customerServerList = !!config.p2pServerList;
var runningWorker;
config.machineId = config.p2pApiKey + '' + config.p2pGroupId
config.p2pTargetAuth = config.p2pTargetAuth || s.gid(30)
if(!config.p2pServerList)config.p2pServerList = {
if(!config.workerStreamOutHandlers){
config.workerStreamOutHandlers = [
'Base64',
'FLV',
'MP4',
];
}
if(!customerServerList){
config.p2pServerList = {
"vancouver-1": {
name: 'Vancouver-1',
host: 'p2p-vancouver-1.shinobi.cloud',
@ -20,21 +30,6 @@ module.exports = function(s,config,lang,app){
lon: -123.1140607
}
},
"vancouver-2": {
name: 'Vancouver-2',
host: 'p2p-vancouver-2.shinobi.cloud',
p2pPort: '8084',
webPort: '8000',
maxNetworkSpeed: {
up: 400,
down: 1000,
shared: true
},
location: {
lat: 49.284966,
lon: -123.1140607
}
},
"toronto-1": {
name: 'Toronto-1',
host: 'p2p-toronto-1.shinobi.cloud',
@ -64,22 +59,18 @@ module.exports = function(s,config,lang,app){
lat: 48.873877,
lon: 2.295533
}
},
"amsterdam-1": {
name: 'Amsterdam-1',
host: 'p2p-amsterdam-1.shinobi.cloud',
p2pPort: '8084',
webPort: '8000',
maxNetworkSpeed: {
up: 500,
down: 500,
shared: true
},
location: {
lat: 52.348773,
lon: 4.8846043
}
},
}
// get latest
fetch('https://cdn.shinobi.video/configs/p2pServers.js')
.then(res => res.text())
.then((text) => {
try{
eval(`config.p2pServerList = ` + text)
}catch(err){
s.debugLog(err)
}
});
}
if(!config.p2pHostSelected)config.p2pHostSelected = 'paris-1'
const stopWorker = () => {