Code Monkey home page Code Monkey logo

ipcress's Introduction

IP Address Compressor

Deployment pipeline

Build Status >> Coverage Status >> Codacy Badge

This project is a demo of Play framework / akka-streams

The Problem

Given a list of IP address in quad-octet form, produce a digest with adrresses with consecutive octet #4 values replaced with a range. The purpose of this is for white/blacklist application Both a web Ui and REST API are provided by this service

Example input

99.243.64.40
99.243.64.41
99.243.64.42
99.244.106.35
99.244.121.59
99.244.121.60
99.244.121.61
99.244.156.149

A resulting digest will be produced:

99.243.64.40-99.243.64.42
99.244.106.35
99.244.121.59-99.244.121.61
99.244.156.149

As well as plain text, JSON format may be specified:

[
  {"ip": ["99.243.64.40", "99.243.64.42"]},
  {"ip": ["99.244.106.35"]},
  {"ip": ["99.244.121.59", "99.244.121.61"]},
  {"ip": ["99.244.156.149"]}
]

Design

Workflow: DigesterService

  def digestFromSource(request: Source[DigestRequest,_]): Future[Seq[Try[String]]] =
    request.async via filter via digester via formatter runWith Sink.seq
+--------+    +--------+    +----------+    +-----------+    +----------+
| (1)    |    | (2)    |    | (3)      |    | (4)       |    | (5)      |
| source | => | filter | => | digester | => | formatter | => | response |
+--------+    +--------+    +----------+    +-----------+    +----------+
  1. Request body is parsed into a iteration over strings, wrapped in a Source
  2. Invalid (e.g., empty) elements are filtered out
  3. Digester algorithm applied to entire collection (needs to be sorted and unique)
  4. Results are formatted as per Accepts header / selection, JSON or Plain
  5. Response body set if results available

Cloud Deployment

see instructions

ipcress's People

Contributors

sothach avatar

Watchers

James Cloos avatar  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.