Skip to main content

Simple Network Simulation For The Funs!

Project description

codecov PyPI - Version PyPI - Python Version EduNet

EduNet

This application allows you to simulate different network operations in a simple plug-in manner.

The motivation with this project was to simply learn more about sockets, protocols, and making them all talk to one another.

The end result of this project is to be able to craft together any network entities and have them communicate as intended.

Simple Supported Use Case

There is a built-in simple supported use case called SimpleHTTPNode.

Bringing this up will start a TCP listener on localhost on port 9999 accepting valid HTTP requests. What will be sent back are valid HTTP responses.

Complex Use Cases

As it will be supported soon, the intent is by using the core architecture, we will be able to implement a router with basic features like:

  • Routing table
  • DHCP assignment
  • Packet forwarding
  • Network Access Translation (NAT)

Simple Example to put it all together

Installing

pip install edunet

Usage

Going back to the Simple use case, as is you can simply do something like:

Starting service

from edunet.core.applications.simple_http_application import SimpleHTTPApplication
from edunet.core.networking.handlers.simple_http_connection_handler import SimpleHTTPConnectionHandler
from edunet.core.networking.listeners.tcp_listener import TCPListener 

# create an HTTP application 
app = SimpleHTTPApplication()

# create a Connection Handler that takes an application
handler = SimpleHTTPConnectionHandler(app)

# A listener is needed to allow connections to come through
listener = TCPListener("127.0.0.1", 9999, handler)

listener.start()

Calling service

You can now communicate with it over HTTP by any means

curl

curl -X GET http://127.0.0.1:9999

python

import urllib.request
response = urllib.request.urlopen("http://localhost:9999")
print(response.read().decode("utf-8"))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edunet-0.2.2.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

edunet-0.2.2-py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page