Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docker ¶
type Docker struct { DockerClient DockerClient Excludes []string AutoAPI bool APIPrefix string RefreshInterval time.Duration }
Docker provider watches compatible for stop/start changes from containers and maps by default from ^/api/%s/(.*) to http://%s:%d/$1, i.e. http://example.com/api/my_container/something will be mapped to http://172.17.42.1:8080/something. Ip will be the internal ip of the container and port exposed in the Dockerfile. Alternatively labels can alter this. reproxy.route sets source route, and reproxy.dest sets the destination. Optional reproxy.server enforces match by server name (hostname) and reproxy.ping sets the health check url Labels can be presented multiple times with a numeric suffix to provide multiple matches for a single container i.e. reproxy.1.server=example.com, reproxy.1.port=12345 and so on
type DockerClient ¶
type DockerClient interface {
ListContainers() ([]containerInfo, error)
}
DockerClient defines interface listing containers and subscribing to events
func NewDockerClient ¶ added in v0.3.0
func NewDockerClient(host, network string) DockerClient
NewDockerClient constructs docker client for given host and network
type DockerClientMock ¶
type DockerClientMock struct { // ListContainersFunc mocks the ListContainers method. ListContainersFunc func() ([]containerInfo, error) // contains filtered or unexported fields }
DockerClientMock is a mock implementation of DockerClient.
func TestSomethingThatUsesDockerClient(t *testing.T) { // make and configure a mocked DockerClient mockedDockerClient := &DockerClientMock{ ListContainersFunc: func() ([]containerInfo, error) { panic("mock out the ListContainers method") }, } // use mockedDockerClient in code that requires DockerClient // and then make assertions. }
func (*DockerClientMock) ListContainers ¶
func (mock *DockerClientMock) ListContainers() ([]containerInfo, error)
ListContainers calls ListContainersFunc.
func (*DockerClientMock) ListContainersCalls ¶
func (mock *DockerClientMock) ListContainersCalls() []struct { }
ListContainersCalls gets all the calls that were made to ListContainers. Check the length with:
len(mockedDockerClient.ListContainersCalls())
type File ¶
File implements file-based provider, defined with yaml file
type Static ¶
type Static struct {
Rules []string // each rule is 4 elements comma separated - server,source_url,destination,ping
}
Static provider, rules are server,source_url,destination[,ping]