IP Address Compressor
This project is a demo of Play framework / akka-streams
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
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"]}
]
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 |
+--------+ +--------+ +----------+ +-----------+ +----------+
Source
Accepts
header / selection, JSON or Plain