go-plugins-helpers
go-plugins-helpers copied to clipboard
serve multiple APIs on single socket
It is useful to be able to serve multiple APIs, e.g. network and ipam, on a single socket. This is something that is anticipated in the plugin architecture / protocol - hence the "Implements" list in the handshake.
Currently this is impossible.
Weave uses that approach, and lack of support for this mode of operation is preventing it from adopting this library.
@rade that sounds like a good idea. Please, feel free to open a pull request with a possible implementation and we'll be very happy to make it happen.
I spent some time looking at this and it appears to require a fair bit of surgery. Especially if this functionality is meant to be an incremental addition, e.g. enable s.t. like
import "github.com/docker/go-plugins-helpers/network"
import "github.com/docker/go-plugins-helpers/ipam"
import "github.com/docker/go-plugins-helpers/sdk"
dn := MyNetworkDriver{}
hn := network.NewHandler(d)
di := MyIPAMDriver{}
hi := ipam.NewHandler(d)
h := sdk.NewCompositeHandler(hn, hi)
h.ServeTCP("my_plugin", ":8080")