mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
35.69k stars 2.32k forks source link

Peer to Peer Network #81

Open batistein opened 4 years ago

batistein commented 4 years ago

Is it possible to draw a peer-to-peer network? In the docs I didn't find a solution

mingrammer commented 4 years ago

Could you please give me an example diagram for p2p network?

batistein commented 4 years ago

excuse me for the very vague question. the question is more about how it is possible to build a mesh network more easily without connecting all the components individually. For example, if you have a wireguard setup, you have to manually enter each node, the question would be if this could be done via an array as in this case:

    pubsub = PubSub("pubsub")

    with Cluster("Source of Data"):
        [IotCore("core1"),
         IotCore("core2"),
         IotCore("core3")] >> pubsub

but instead of connecting all components of the array directly with another component, in this case all components of the array should be connected with all components of the array itself. I hope now it's more clear.

mingrammer commented 4 years ago

Got it, I understand it. In this case, we can provide a special function for connecting all provided nodes to each other like this:

from diagrams import P2P
...
    P2P(IoTCore("core1"), IoTCore("core2"), IoTCore("core3"))

However, it's not clear what node should be returned from the call of P2P(). Any ideas? :)