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