Thomas Rory Gummerson
7 years ago
19 changed files with 135 additions and 99 deletions
@ -1,12 +1,14 @@ |
|||||
var readServers = require('../utils/listFile').readServers; |
'use strict'; |
||||
var prettyjson = require('prettyjson'); |
|
||||
|
|
||||
var EOL = require('os').EOL; |
const { readServers } = require('../utils/listFile'); |
||||
|
const prettyjson = require('prettyjson'); |
||||
|
|
||||
|
const { EOL } = require('os'); |
||||
|
|
||||
function listServers() { |
function listServers() { |
||||
var serversList = readServers(); |
const serversList = readServers(); |
||||
if(serversList) console.log(EOL + prettyjson.render(serversList) + EOL); |
if(serversList) console.log(EOL + prettyjson.render(serversList) + EOL); |
||||
else console.log("\nNo servers were found! Create some using `up`!\n"); |
else console.log("\nNo servers were found! Create some using `up`!\n"); |
||||
} |
} |
||||
|
|
||||
module.exports = listServers; |
module.exports = listServers; |
||||
|
@ -1,7 +1,9 @@ |
|||||
var https = require('https'); |
'use strict'; |
||||
var fs = require('fs-extra'); |
|
||||
|
|
||||
var file = fs.createWriteStream("./assets/tlds.txt"); |
const https = require('https'); |
||||
|
const fs = require('fs-extra'); |
||||
|
|
||||
|
const file = fs.createWriteStream("./assets/tlds.txt"); |
||||
https.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt", function(response) { |
https.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt", function(response) { |
||||
response.pipe(file); |
response.pipe(file); |
||||
}); |
}); |
||||
|
@ -1,7 +1,9 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
// Simple function that takes a path and domain name, concatenates them with ".conf" and returns it.
|
// Simple function that takes a path and domain name, concatenates them with ".conf" and returns it.
|
||||
|
|
||||
function conf(path, domain, outPort) { |
function conf(path, domain, outPort) { |
||||
return (path + domain + "." + outPort + ".conf"); |
return (path + domain + "." + outPort + ".conf"); |
||||
} |
} |
||||
|
|
||||
module.exports = conf; |
module.exports = conf; |
||||
|
@ -1,8 +1,10 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
// Parse an input string and return a number if it is an integer. If it's a float, string, or array, return undefined.
|
// Parse an input string and return a number if it is an integer. If it's a float, string, or array, return undefined.
|
||||
|
|
||||
function parseToInt(inputString) { |
function parseToInt(inputString) { |
||||
var parsing = /^\d+$/.exec(inputString); |
const parsing = /^\d+$/.exec(inputString); |
||||
return (parsing || [])[0]; |
return (parsing || [])[0]; |
||||
} |
} |
||||
|
|
||||
module.exports = parseToInt; |
module.exports = parseToInt; |
||||
|
Loading…
Reference in new issue