mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-14 00:11:28 +05:30
b7ffbdb74f
Signed-off-by: David Calavera <david.calavera@gmail.com>
39 lines
893 B
Go
39 lines
893 B
Go
package plugin
|
|
|
|
import (
|
|
"net/rpc"
|
|
|
|
"github.com/calavera/docker-credential-helpers/credentials"
|
|
"github.com/hashicorp/go-plugin"
|
|
)
|
|
|
|
var handshakeConfig = plugin.HandshakeConfig{
|
|
ProtocolVersion: 1,
|
|
MagicCookieKey: "DOCKER_CREDENTIAL_PLUGIN",
|
|
MagicCookieValue: "nyzGgJQpfOYO$oUVHo4RsLaYaNmCqeWLEqZnZG}peMVq4nXdFp",
|
|
}
|
|
|
|
type credentialsPlugin struct {
|
|
helper credentials.Helper
|
|
}
|
|
|
|
func (p *credentialsPlugin) Server(*plugin.MuxBroker) (interface{}, error) {
|
|
return p, nil
|
|
}
|
|
|
|
func (*credentialsPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// Serve initializes the socket connection to a store helper.
|
|
func Serve(helper credentials.Helper) {
|
|
pluginMap := map[string]plugin.Plugin{
|
|
"credentials": &credentialsPlugin{helper},
|
|
}
|
|
|
|
plugin.Serve(&plugin.ServeConfig{
|
|
HandshakeConfig: handshakeConfig,
|
|
Plugins: pluginMap,
|
|
})
|
|
}
|