Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (59 sloc) 1.3 KB
/*
Package dockerplugin is a library taking care of the generic code for docker plugins written in go.
*/
package dockerplugin // import "go.pedge.io/dockerplugin"
import (
"github.com/gengo/grpc-gateway/runtime"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
const (
// DefaultGRPCPort is the default port used for grpc.
DefaultGRPCPort uint16 = 2150
)
// Server serves a VolumeDriver.
type Server interface {
Serve() error
}
// ServerOptions are options for a Server.
type ServerOptions struct {
GRPCPort uint16
}
// NewTCPServer returns a new Server for TCP.
func NewTCPServer(
driverName string,
implements []string,
registerFunc func(*grpc.Server),
httpRegisterFunc func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error,
address string,
opts ServerOptions,
) Server {
return newServer(
protocolTCP,
driverName,
implements,
registerFunc,
httpRegisterFunc,
address,
opts,
)
}
// NewUnixServer returns a new Server for Unix sockets.
func NewUnixServer(
driverName string,
implements []string,
registerFunc func(*grpc.Server),
httpRegisterFunc func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error,
group string,
opts ServerOptions,
) Server {
return newServer(
protocolUnix,
driverName,
implements,
registerFunc,
httpRegisterFunc,
group,
opts,
)
}