network

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2018 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package network wraps docker network and ensures exposure of HTTP end-points to containers attached to said network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle struct {
	// contains filtered or unexported fields
}

Handle for a network managed by a Pool

func (*Handle) Gateway

func (h *Handle) Gateway() string

Gateway returns the IP hosting the http.Handler given in New

func (*Handle) NetworkID

func (h *Handle) NetworkID() string

NetworkID returns the docker network identifier for this network

func (*Handle) Release

func (h *Handle) Release()

Release returns the Network to the Pool

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network wraps a docker network and server listening for requests on the gateway IP, used as meta-data service.

func New

func New(client *docker.Client, monitor runtime.Monitor) (*Network, error)

New creates a new Network

func (*Network) Dispose

func (n *Network) Dispose() error

Dispose releases resources used by the Network and destroys it

func (*Network) Gateway

func (n *Network) Gateway() string

Gateway returns the IP hosting the http.Handler given in New

func (*Network) NetworkID

func (n *Network) NetworkID() string

NetworkID returns the docker network identifier for this network

func (*Network) SetHandler

func (n *Network) SetHandler(handler http.Handler)

SetHandler allows setting an http.Handler for requests to the gateway IP on port 80. This maybe called multiple times to overwrite the handler and it maybe be called with nil to unset the handler.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool tracks a set of networks ensuring that they can be re-used

func NewPool

func NewPool(client *docker.Client, monitor runtime.Monitor) *Pool

NewPool returns a new Network pool

func (*Pool) Dispose

func (p *Pool) Dispose() error

Dispose all Networks held by this Pool.

All Handles must have been released before this method is called.

func (*Pool) GetNetwork

func (p *Pool) GetNetwork(handler http.Handler) (*Handle, error)

GetNetwork returns a handle for an idle Network

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL