porech / engarde

A go network utility to create a reliable IP tunnel over multiple connections
GNU General Public License v2.0
276 stars 41 forks source link

Unify client and server, allow multiple instances in the same process #20

Open ale-rinaldi opened 4 years ago

ale-rinaldi commented 4 years ago

There's no reason why client and server should be two different executables. Also, there's no reason why a single process can hold only a single configuration.

It would be more comfortable to be able to insert multiple configurations into the same YML file, and run them together into the same process. Each config would have a "type" parameter to specify if it's client or server.

For example:

pcToServer:
    type: client
    description: "I am the first client"
    listenAddr: "127.0.0.1:59402"
    dstAddr: "203.0.113.1:59401"
    webManager:
        listenAddr: "0.0.0.0:9001"

pcToAnotherServer:
    type: client
    description: "I am the second client"
    listenAddr: "127.0.0.1:59402"
    dstAddr: "203.0.113.2:59401"
    webManager:
        listenAddr: "0.0.0.0:9002"

iAlsoActAsServer:
    type: server
    description: "This time, I am a server"
    listenAddr: "0.0.0.0:59501"
    dstAddr: "127.0.0.1:59301"
    webManager:
        listenAddr: "0.0.0.0:9003"

To keep compatibility with the current config file, a configuration named "client" would automatically set its type as client, and a configuration name "server" would automatically set its type as server.

This issue is also a discussion point to evaluate the feature: if you feel like this could break your workflow, or that there's a better way to handle this, let's talk about it!

xela92 commented 4 years ago

If it's not gonna break compatibility with the actual configuration (that I feel more confortable, even if it's limited) I think it could be useful to manage complex configurations. One can simply configure everything he needs in one place and then run one single process to handle everything. Do you think it could have side effects? E.G. limit speedrates?

Marctraider commented 4 years ago

It would indeed be handy having just a single executable for both client/server, easier for future development/build generation and for end users to maintain/update.