function getDisplayURL( url ) { var parser = document.createElement( 'a' ); parser.href = url; return ( parser.hostname + parser.pathname ).replace( /\/$/, '' ); }
list.forEach(function(item) { var host = item.isHttps ? item.path : item.hostname; if (hostList.indexOf(host) === -1) { hostList.push(host); } });
function getHostname(_url) { if (typeof _url != 'string') { return ''; } if (_url.indexOf('/') != -1) { return url.parse(_url).hostname; } var index = _url.indexOf(':'); return index == -1 ? _url : _url.substring(0, index); }
http.createServer(function(req, res) { var fullUrl = /^http:/.test(req.url) ? req.url : 'http://' + req.headers.host + req.url; var options = parseUrl(fullUrl); delete options.hostname; options.host = '127.0.0.1'; options.method = req.method; options.headers = req.headers; var client = http.request(options, function(_res) { _res.pipe(res); }); req.pipe(client); })
function check (is, chunk, level, msg) { is(new Date(chunk.time) <= new Date(), true, 'time is greater than Date.now()') delete chunk.time is(chunk.pid, pid) is(chunk.hostname, hostname) is(chunk.level, level) is(chunk.msg, msg) }
const getOsInfo = () => { return { uptime: os.uptime(), type: os.type(), release: os.release(), hostname: os.hostname(), arch: os.arch(), platform: os.platform(), user: getUserInfo() }; }
originUrl() { return ( window.location.protocol + '//' + window.location.hostname + ( window.location.port ? ':' + window.location.port : '' ) ); }
/** * Get default NodeID (computerName) * * @returns */ getNodeID() { return os.hostname().toLowerCase() + "-" + process.pid; }
function formatDnsLookupUrl(host, url, address) { if (typeof url === 'string') return url.replace(host, address); const urlObj = utility.assign({}, url); urlObj.hostname = urlObj.hostname.replace(host, address); if (urlObj.host) { urlObj.host = urlObj.host.replace(host, address); } return urlObj; }
function getHost(url) { var a = window.document.createElement('a'); a.href = url; let obj={ protocol: a.protocol, host: a.hostname, port: a.port, }; return obj.protocol+"//"+obj.host+((obj.port && obj.port!=80)?(":"+obj.port):""); }
bindings (bindings) { return { process: { pid: bindings.pid }, host: { name: bindings.hostname } } }
function bindings () { const chindings = this[chindingsSym] var chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" var bindingsFromJson = JSON.parse(chindingsJson) delete bindingsFromJson.pid delete bindingsFromJson.hostname return bindingsFromJson }
function getHost(url) { var a = window.document.createElement('a'); a.href = url; let obj={ protocol: a.protocol, host: a.hostname, port: a.port, }; return obj.protocol+"//"+obj.host+((obj.port && obj.port!=80)?(":"+obj.port):""); }
function getOriginUrl() { return ( window.location.protocol + '//' + window.location.hostname + ( window.location.port ? ':' + window.location.port : '' ) ); }