Git Product home page Git Product logo

firewall-rules's Introduction

Firewall-Rules

Implementation Details:

As firewall rules are changed often and used always during transmitting or receiving all the network packets it is important to have O(1) time complexity for checking if the packet is allowed by the existing firewall rules. Therefore, a hash is created for storing all the firewall rules to check if a network packet having particular ip address, port, protocol and direction is be allowed or blocked. All port and all ips case is handled separately to save on space. This solution has more space complexity but less time complexity.

Testing:

Tested code with different test cases for the rules provided in the problem description. Have checked most of the edge cases like start/end ip and port in a particular range. Have also checked code for all ips and all port case as that is handled seperately in the code.

Refinement and Optimizations:

I would have tried using different data structure to reduce on space complexity by adjusting the tadeoff between space and time complexity. Using a tree like data structure would have reduced space but hampered time complexity. Also would have handled ranged ips/ports effectively if more time was offered. Actually, this decision is based on the input i.e if more input are direct ips/port or ranges and what we can compromise on in terms of complexity i.e space or time.

firewall-rules's People

Contributors

shashwatarghode avatar

Watchers

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