bridges

package
v0.0.1-dev.137 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package bridges enumerates Docker bridge networks so the agent's embedded DNS server can bind on each bridge gateway IP. Containers on user-defined networks reach `<service>.<namespace>.rune` through their own gateway, so the agent must serve DNS on every bridge the host has, not just the default 172.17.0.1.

The implementation is a small, dependency-light helper around the Docker SDK's NetworkList / NetworkInspect. Errors from the Docker daemon are surfaced to the caller so they can decide whether to log-and-continue or hard-fail (the agent typically does the former because the loopback bind on 127.0.0.123 is sufficient for the no-Docker dev path).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient() (*client.Client, error)

NewClient is a thin wrapper around client.NewClientWithOpts(client.FromEnv) for callers that don't already have a Docker client. Returned client should be Closed by the caller.

Types

type Gateway

type Gateway struct {
	NetworkID   string
	NetworkName string
	IP          net.IP
}

Gateway pairs a Docker network's name with one of its bridge gateway IPs.

func EnumerateGateways

func EnumerateGateways(ctx context.Context, c Lister) ([]Gateway, error)

EnumerateGateways returns the IPv4 gateway address of every Docker network with driver "bridge". The default `bridge` network is included alongside any user-defined networks (e.g. those created by docker-compose).

func (Gateway) String

func (g Gateway) String() string

String returns "<networkName>=<ip>".

type Lister

type Lister interface {
	NetworkList(ctx context.Context, options network.ListOptions) ([]network.Inspect, error)
	NetworkInspect(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, error)
}

Lister is satisfied by *client.Client; defined as an interface so callers can inject a fake in tests.

Jump to

Keyboard shortcuts

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