This commit is contained in:
Mateusz Gruszczyński committed 2026-11-14 17:24:12 +01:00
1 parent 78dbb31487
commit f48843e934
83 files changed
+7304 -1203

No files matched your search

+1 -1
View File
@@ -139,6 +139,6 @@ The API is `GET /v1/inventory` with `Authorization: Bearer <token>`; `GET /healt
- `x509` or fingerprint mismatch in RustProxy: compare `sudo rustproxy-docker-agent print-fingerprint` with the pin configured in Settings.
- Cannot reach port `9876`: check `RUSTPROXY_DOCKER_AGENT_LISTEN`, listening socket, firewall, and that HTTPS is used.
`RUSTPROXY_DOCKER_ADVERTISE_IP` adds a preferred host address without suppressing automatic address discovery. `RUSTPROXY_DOCKER_PUBLIC_IP_URL` controls the optional externally observed public IP. The agent's Docker socket access remains privileged; isolate the Docker host and network accordingly.
`RUSTPROXY_DOCKER_ADVERTISE_IP` adds a preferred host address without suppressing automatic address discovery. Since 0.37.1 the agent also reports the addresses of container bridge interfaces (`docker0`, `br-*`, `podman*`, `cni-*`, `virbr*`) with source `bridge`, listed last; veth interfaces are never reported. `RUSTPROXY_DOCKER_PUBLIC_IP_URL` controls the optional externally observed public IP. The agent's Docker socket access remains privileged; isolate the Docker host and network accordingly.
Default `technical_name` uses the sanitized Docker container name (including Docker Compose container names), not the image or a port suffix. Each published TCP port still has an independent stable service key.
+1 -1
View File
@@ -1,6 +1,6 @@
package main
var version = "0.37.0" // overridden by the package builder using -ldflags -X main.version
var version = "0.37.1" // overridden by the package builder using -ldflags -X main.version
type config struct {
Listen string
+31 -2
View File
@@ -71,14 +71,37 @@ func skipInterface(name string) bool {
return name == "docker0" || strings.HasPrefix(name, "docker") || strings.HasPrefix(name, "veth") || strings.HasPrefix(name, "br-") || strings.HasPrefix(name, "virbr")
}
func bridgeInterface(name string) bool {
name = strings.ToLower(strings.TrimSpace(name))
if strings.HasPrefix(name, "veth") {
return false
}
return skipInterface(name) || strings.HasPrefix(name, "podman") || strings.HasPrefix(name, "cni-")
}
func localHostAddresses() []hostAddress {
return interfaceAddresses(false)
}
func bridgeHostAddresses() []hostAddress {
return interfaceAddresses(true)
}
func interfaceAddresses(bridges bool) []hostAddress {
interfaces, err := net.Interfaces()
if err != nil {
return nil
}
source := "interface"
if bridges {
source = "bridge"
}
out := make([]hostAddress, 0)
for _, iface := range interfaces {
if iface.Flags&net.FlagUp == 0 || iface.Flags&net.FlagLoopback != 0 || skipInterface(iface.Name) {
if iface.Flags&net.FlagUp == 0 || iface.Flags&net.FlagLoopback != 0 {
continue
}
if bridges != bridgeInterface(iface.Name) || (!bridges && skipInterface(iface.Name)) {
continue
}
addrs, err := iface.Addrs()
@@ -97,7 +120,7 @@ func localHostAddresses() []hostAddress {
continue
}
ip := net.ParseIP(clean)
out = append(out, hostAddress{IP: clean, Source: "interface", Interface: iface.Name, Scope: ipScope(ip)})
out = append(out, hostAddress{IP: clean, Source: source, Interface: iface.Name, Scope: ipScope(ip)})
}
}
sort.Slice(out, func(i, j int) bool {
@@ -176,6 +199,12 @@ func detectedAddresses(ctx context.Context, cfg config, detector *ipDetector) ([
if advertised != "" {
mergeHostAddress(&out, index, hostAddress{IP: advertised, Source: "override"})
}
for _, item := range bridgeHostAddresses() {
if len(out) >= 48 {
break
}
mergeHostAddress(&out, index, item)
}
switch {
case advertised != "":
+18
View File
@@ -188,3 +188,21 @@ func TestProvisionCodeRoundTrip(t *testing.T) {
t.Fatal("garbage accepted")
}
}
func TestBridgeInterfacesAreReportedSeparately(t *testing.T) {
for name, want := range map[string]bool{"docker0": true, "br-1a2b": true, "virbr0": true, "podman0": true, "cni-podman0": true, "veth12": false, "eth0": false, "br0": false, "wg0": false} {
if got := bridgeInterface(name); got != want {
t.Fatalf("%s: %v", name, got)
}
}
for _, item := range localHostAddresses() {
if item.Source != "interface" || bridgeInterface(item.Interface) {
t.Fatalf("host address %#v", item)
}
}
for _, item := range bridgeHostAddresses() {
if item.Source != "bridge" || !bridgeInterface(item.Interface) {
t.Fatalf("bridge address %#v", item)
}
}
}