Socket
Socket
Sign inDemoInstall

ntfd

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ntfd - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

static/ntfd.js

11

lib/ntfd/global.js

@@ -1,5 +0,14 @@

var redisLib = require('redis')
var events = require('events')
, util = require('util')
, redisLib = require('redis')
exports.SEP = '\x01'
exports.io = null
exports.redis = null
function Events() { events.EventEmitter.call(this) }
util.inherits(Events, events.EventEmitter)
exports.events = new Events()
exports.setup = function(config) {

@@ -6,0 +15,0 @@ exports.config = config

@@ -54,2 +54,3 @@ var async = require('async')

if (options.full) data.results = results
global.events.emit('test', data)
callback(null, data)

@@ -56,0 +57,0 @@ })

@@ -55,3 +55,15 @@ var express = require('express')

var io = global.io = require('socket.io').listen(app)
app.configure('production', function() {
io.set('log level', 1)
})
io.sockets.on('connection', function (socket) {
global.events.on('test', function(data) {
socket.broadcast.emit('test', data)
})
})
return app
}

1

lib/ntfd/periodic.js

@@ -30,3 +30,2 @@ var async = require('async')

for (var name in suites) {
var suite = suites[name]
global.redis.zadd('test/' + name, time, time + global.SEP + JSON.stringify(suites[name]))

@@ -33,0 +32,0 @@ }

var global = require('./global')
, helper = require('./helper')
, ntf = require('ntf')

@@ -11,5 +12,3 @@ module.exports = function(app) {

if (!cacheControl) {
return timeout
}
if (!cacheControl) return timeout

@@ -20,2 +19,16 @@ var ageAge = cacheControl.match(/max-age=([\d]+)/)

var formatTestName = function(desc) {
desc = desc.split(ntf.utils.SEP)
var html = '<a href="' + desc[0] + '">' + desc[0] + '</a>'
if (desc[0].match(/^https?:\/\//)) {
html = desc[1] + ' ' + html
}
html += ' &ndash; ' + desc[desc.length-1]
return html
}
var render = function(req, res, template, data) {

@@ -28,3 +41,3 @@ var callback = req.query.callback

} else if (req.accepts('html')) {
res.render(template, { data: data, noJquery: true, noSocketIo: true })
res.render(template, { data: data, formatTestName: formatTestName })
} else if (req.accepts('json')) {

@@ -41,5 +54,16 @@ res.json(data)

app.get('/', function(req, res) {
res.render('index.html', {})
})
app.get('/test', function(req, res) {
var data = Object.keys(module)
data.sort()
data = data.map(function(name) { return { name: name, url: '/test/' + name } })
render(req, res, 'test.html', data)
})
app.get('/test/all', function(req, res) {
helper.runTests(module, { full: true, maxAge: maxAge(req) }, function(err, data) {
render(req, res, 'test.html', data)
render(req, res, 'test_all.html', data)
})

@@ -46,0 +70,0 @@ })

{
"name": "ntfd",
"description": "Network Testing Framework Daemon",
"version": "0.0.1",
"version": "0.0.2",
"engines": { "node": ">= 0.4" },

@@ -14,4 +14,5 @@ "dependencies": {

"nomnom": ">= 1.5.1",
"ntf": ">= 0.0.1",
"redis": ">= 0.6.7"
"ntf": ">= 0.0.3",
"redis": ">= 0.6.7",
"socket.io": ">= 0.8.7"
},

@@ -18,0 +19,0 @@ "repository": {

@@ -15,6 +15,8 @@ ntfd

# install library
Install ntfd
npm install -g ntfd
# create config file
Create configuration file
cat << EOF > ntfd.conf

@@ -25,2 +27,7 @@ [http]

[redis]
host = 127.0.0.1
port = 6379
database = 0
[test]

@@ -31,3 +38,4 @@ module = ntfd

# run daemon
Run ntfd
ntfd -c ntfd.conf

@@ -34,0 +42,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc