Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Implement network related models #94

Closed
umamaistempo opened this issue Mar 31, 2017 · 0 comments
Closed

Implement network related models #94

umamaistempo opened this issue Mar 31, 2017 · 0 comments
Assignees

Comments

@umamaistempo
Copy link
Contributor

This issue relates to implementing basic models that will be used to properly
implement basic network functionality

Information can be found on the wiki page about internet connections

A network connection is comprised by a Tunnel that contains Links and
Connections

Tunnel

Represent a certain medium to connect from the gateway server to the
destination server. A tunnel contains several Links. Connections use the
Tunnel.

The Tunnel model is composed by:

  • Unique ID
  • network_id
  • gateway_id
  • destination_id
  • hash*

* Hash is a precomputed value generated by applying a certain hash function to
all links onto a Tunnel. This is done so a user can have multiple Tunnels to a
certain destination server and allow the backend to lazily receive the action as
a collection of nodes (and thus reuse a Tunnel)

Link

A link is the edge from a certain node used in the Tunnel to another. A Tunnel
is composed by 1 or more links and those links (and their order) affect the
side-effects of a certain network action.

On Tunnel that emanates from Node onto Node through the path
A -> B -> C -> D we have the links A -> B, B -> C and C -> D.

The link model is composed by

  • tunnel_id
  • source_id
  • destination_id
  • sequence*

* Sequence id is a precalculated integer to order the edges. This could be
avoided by using a linked list approach on the database side, but it is faster
to prototype this way

Connection

A connection represents an action that is happening through a Tunnel and that
was started by the gateway and targets the destination.

That is, if a certain user is trying to crack into a certain destination
computer through certain bounce nodes, it would start a Tunnel with those nodes
and start a "crack" connection. After the crack is complete and the user gets
into the target server, the "crack" connection finishes and a "ssh" connection
starts. If the user decides to download a file, then they have simultaneously
a "ssh" connection (because they are logged into the target system) and a "ftp"
connection (because they are transfering files to/from the target system)

The connection model is composed by

  • Unique ID*
  • tunnel_id
  • Connection Type

* This unique id is used to allow a certain tunnel to have more than one
connection of a certain kind (ie: download a dozen of files in parallel) and
also to provide visual cue to players that two simillar connections of the same
kind are different

ConnectionType

Naturally since a connection has a type and the amount of possible types is
limited, it is better to introduce a lookup table to provide referential
integrity

About tunnel implementation

On the Tunnel's model i see the following functions:

create(Network.t, gateway :: Server.id, destination :: Server.id, bounces :: [node, ...]) :: %Tunnel{links: [Link.t, ...]}

On this case, the links builder inside tunnels model would make a set of input
nodes (and fail if any is repeated) and also ensure that the first node is the
gateway and the last node is the destination

@umamaistempo umamaistempo added this to the Network application and feature milestone Mar 31, 2017
@umamaistempo umamaistempo self-assigned this Mar 31, 2017
umamaistempo added a commit to umamaistempo/Helix that referenced this issue Apr 3, 2017
@umamaistempo umamaistempo removed this from the Network application and feature milestone Apr 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant