Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

toxy

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

toxy - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

examples/time-threshold.js

1

lib/rules/index.js

@@ -7,2 +7,3 @@ module.exports = [

'content-type',
'time-threshold',
'response-body',

@@ -9,0 +10,0 @@ 'response-status',

7

package.json
{
"name": "toxy",
"version": "0.3.4",
"version": "0.3.5",
"description": "Hackable HTTP proxy to simulate server failure scenarios and unexpected network conditions",

@@ -29,3 +29,6 @@ "repository": "h2non/toxy",

"latency",
"jitter"
"jitter",
"failover",
"distributed",
"soa"
],

@@ -32,0 +35,0 @@ "engines": {

@@ -45,2 +45,3 @@ # toxy [![Build Status](https://api.travis-ci.org/h2non/toxy.svg?branch=master&style=flat)](https://travis-ci.org/h2non/toxy) [![Code Climate](https://codeclimate.com/github/h2non/toxy/badges/gpa.svg)](https://codeclimate.com/github/h2non/toxy) [![NPM](https://img.shields.io/npm/v/toxy.svg)](https://www.npmjs.org/package/toxy)

- [Probability](#probability)
- [Time threshold](#time-threshold)
- [Method](#method)

@@ -185,2 +186,3 @@ - [Content Type](#content-type)

.withRule(rules.method('GET'))
.withRule(rules.timeThreshold({ duration: 1000, threshold: 1000 * 10 }))
.withRule(rules.responseStatus({ range: [ 200, 400 ] }))

@@ -615,2 +617,29 @@

#### Time threshold
<table>
<tr>
<td><b>Name</b></td><td>timeThreshold</td>
</tr>
<tr>
<td><b>Poison Phase</b></td><td>incoming / outgoing</td>
</tr>
</table>
Simple rule to enable poisons based on a specific time threshold and duration.
For instance, you can enable a certain poisons during a specific amount of time (e.g: 1 second) within a time threshold (e.g: 1 minute).
**Arguments**:
- **options** `object`
- **duration** `number` - Enable time inverval in miliseconds. Default to `1000`
- **threshold** `number` - Time period threshold in miliseconds to wait before re-enable the poisoning. Default to `10000`
```js
// Enable the poisoning only 100 miliseconds per each 10 seconds
proxy.rule(toxy.rules.timeThreshold(100))
// Enable poisoning during 1 second every minute
proxy.rule(toxy.rules.timeThreshold({ duration: 1000, period: 1000 * 60 }))
```
#### Method

@@ -617,0 +646,0 @@

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