Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface {
MapPorts(MapPortsRequest) (MapPortsResponse, error)
UnmapPorts(UnmapPortsRequest) error
}
type ErrorResponse ¶
type ErrorResponse struct {
Err string
}
ErrorResponse is a formatted error message that libnetwork can understand
func NewErrorResponse ¶
func NewErrorResponse(msg string) *ErrorResponse
NewErrorResponse creates an ErrorResponse with the provided message
type Handler ¶
Handler forwards requests and responses between the docker daemon and the plugin.
func NewHandler ¶
NewHandler initializes the request handler with a driver implementation.
type MapPortsRequest ¶
type MapPortsRequest struct {
// Reqs is a group of port bindings that should get the same port assigned
// when an ephemeral port, or a port range is requested. Each Reqs should
// yield an independent PortBinding.
Reqs []PortBindingReq
// Labels is a set of opaque, user-specified freeform labels that can be
// used to tweak how the port-mapper behaves.
Labels map[string]string
}
MapPortsRequest is the API request sent to the PortMapper plugin to map a port.
type MapPortsResponse ¶
type MapPortsResponse struct {
PortBindings []PortBinding
Err string
}
type PortBinding ¶
type PortBinding struct {
Proto Protocol
BackendIP netip.Addr
BackendPort uint16
FrontendIP netip.Addr
// FrontendPort is the frontend port picked by the PortMapper when an
// ephemeral port, or a port range was specified in the request.
FrontendPort uint16
// DiscardReq is returned when the PortBindingReq can't be fulfilled, but
// the driver deems it's not a fatal error.
DiscardReq bool
// AllowForwarding indicates whether forwarding to BackendIP:BackendPort
// should be configured by the Engine.
AllowForwarding bool
// NAT is returned by the portmapper when it needs the Engine to configure
// the host firewall to NAT a port to BackendIP:BackendPort.
NAT *NATRule
// Error indicates the reason why this port binding was discarded. This
// error is logged.
Error *string
}
PortBinding is returned by the PortMapper when a request has been processed.
type PortBindingReq ¶
type PortBindingReq struct {
Proto Protocol
BackendIP netip.Addr
BackendPort uint16
FrontendIP netip.Addr
// FrontendPort is either an exact port, an ephemeral port (= 0), or the start
// of a port range.
FrontendPort uint16
// FrontendPortEnd should be the same as HostPort when an exact or ephemeral
// port is requested. Otherwise, it should be the end of the port range.
FrontendPortEnd uint16
}
type UnmapPortsRequest ¶
type UnmapPortsRequest struct {
PortBindings []PortBinding
Labels map[string]string
}
Click to show internal directories.
Click to hide internal directories.