Answer the question
In order to leave comments, you need to log in
How to implement modularity?
Now I have a software with a bunch of functions (in general, it covers about 3 different audiences in the field of hacking), I want to divide it into modules, and then stupidly sell the modules for the network. Sounds fine) But how I started to google... It was a scribe)
I want to include already compiled modules that should extend the command parsing function. Now she receives json format
{
command: "name modules",
flag : "data command"
}
Answer the question
In order to leave comments, you need to log in
Golang is compiled into 1 binary by default. Yes, you can connect shared libs, yes you can assemble them, but the language is not designed for this.
To connect the functionality - google on the topic "golang unsafe", "golang load dynamic library". But generally speaking, this is not the golang-way with all its might.
quite an option
You need some kind of resolver that will be filled with metadata about your commands when the application starts. Further, based on the collected data, you will need to configure the command parser.
If you want to do something like that with the help of separate microservices, you will need at least one more, which will distribute the actions among the rest. For example, through a queue server, or rpc. In any case, you will have to design a communication protocol between services. And if running through the console is another client. Roughly speaking, this thing might look like this:
[client] <-??-> [client-app] <-rpc|queue|...-> [main-server] <-rpc|queue|...=>[ modules]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question