Coder Social home page Coder Social logo

gatekeeper's Introduction

Gatekeeper

Language Build Status codecov GitHub license

Rate Limiter and SSL enforcing middleware.

Integration

Update your Package.swift file.

.Package(url: "https://github.com/nodes-vapor/gatekeeper", majorVersion: 0)

Getting started ๐Ÿš€

Both the rate limiter and SSL-enforcing middleware are easy to configure and get running.

SSLEnforcer ๐Ÿ”’

SSLEnforcer has three configurable fields: the error to be thrown, your Droplet and the environments you wish to enforce on. The environments defaults to [.production].

let drop = Droplet()
// this will only enforce if running in `production` mode.
let enforcer = SSLEnforcer(error: Abort.notFound, drop: drop)

If you wish to secure your endpoints during development you can do the following:

let enforcer = SSLEnforcer(
    error: Abort.notFound,
    drop: drop,
    environments: [
        .production,
        .development
    ]
)

RateLimiter โฑ

RateLimiter has two configurable fields: the maximum rate and the cache to use. If you don't supply your own cache the limiter will create its own, in-memory cache.

let limiter = RateLimiter(rate: Rate(10, per: .minute))

The Rate.Interval enumeration

The currently implemented intervals are:

case .second
case .minute
case .hour
case .day

Credits ๐Ÿ†

This package is developed and maintained by the Vapor team at Nodes.

License ๐Ÿ“„

This package is open-sourced software licensed under the MIT license

gatekeeper's People

Contributors

brettrtoomey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.