Documentation
¶
Index ¶
- type Backend
- type Client
- func (c *Client) BaseDomain() string
- func (c *Client) Close() error
- func (c *Client) DiscoverBackends(ctx context.Context) ([]*Backend, error)
- func (c *Client) DockerClient() DockerAPI
- func (c *Client) GetBackend(ctx context.Context, containerID string) (*Backend, error)
- func (c *Client) GetProjectBackends(ctx context.Context, projectName string) ([]*Backend, error)
- func (c *Client) NetworkName() string
- type ContainerEvent
- type DockerAPI
- type EventType
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
ContainerID string
ContainerName string
ServiceName string // docker-compose service name
ProjectName string // docker-compose project name
Host string // Container IP in the shared network
Port int
Hostname string // The hostname to route to this backend
PathPrefix string // Optional path prefix
}
Backend represents a proxied service
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker client for container discovery
func NewClientWithAPI ¶
NewClientWithAPI creates a new client with a custom DockerAPI implementation This is useful for testing with mock implementations
func (*Client) BaseDomain ¶
BaseDomain returns the base domain for hostnames
func (*Client) DiscoverBackends ¶
DiscoverBackends finds all containers connected to the shared network
func (*Client) DockerClient ¶
DockerClient returns the underlying Docker API client (for event watching)
func (*Client) GetBackend ¶
GetBackend gets a single backend by container ID
func (*Client) GetProjectBackends ¶
GetProjectBackends gets all backends for a specific project
func (*Client) NetworkName ¶
NetworkName returns the network name being watched
type ContainerEvent ¶
ContainerEvent represents a container start/stop event
type DockerAPI ¶
type DockerAPI interface {
ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
Events(ctx context.Context, options events.ListOptions) (<-chan events.Message, <-chan error)
Close() error
}
DockerAPI defines the interface for Docker API operations This interface allows for mocking in tests
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches for container events on the shared network
func NewWatcher ¶
NewWatcher creates a new container watcher