jeessy2/ddns-go · warning
interface %s not found: %v
Error message
interface %s not found: %v
What it means
Returned by getLocalAddrFromInterfaceByNetwork (util/http_client_util.go:15) when net.InterfaceByName(ifaceName) fails, i.e. the configured network interface name does not exist on this machine. CreateBoundNoProxyHTTPClient calls it to bind an HTTP client to a specific interface; on failure it logs and silently falls back to the default (no-proxy) client, so callers usually only see the log line, not a hard error.
Source
Thrown at util/http_client_util.go:15
package util
import (
"context"
"crypto/tls"
"fmt"
"net"
"net/http"
"time"
)
func getLocalAddrFromInterfaceByNetwork(ifaceName, network string) (string, error) {
iface, err := net.InterfaceByName(ifaceName)
if err != nil {
return "", fmt.Errorf("interface %s not found: %v", ifaceName, err)
}
addrs, err := iface.Addrs()
if err != nil {
return "", fmt.Errorf("get interface %s addresses failed: %v", ifaceName, err)
}
hasGlobalUnicast := false
for _, addr := range addrs {
ipNet, ok := addr.(*net.IPNet)
if !ok || !ipNet.IP.IsGlobalUnicast() {
continue
}
hasGlobalUnicast = true
if isIPMatchedNetwork(ipNet.IP, network) {
return ipNet.IP.String(), nil
}
}
if hasGlobalUnicast && (network == "tcp4" || network == "tcp6") {View on GitHub (pinned to 5874c2e666)
Solutions
- Check the actual interface name with `ip link` (Linux), `ifconfig` (macOS) or `ipconfig` (Windows) and fix the configured name
- Remove/clear the interface binding setting to fall back to the default client
- If in a container, use the container's own interface (usually eth0) instead of the host's
- Re-check after NIC renames or driver updates on the host
Example fix
// before
client := util.CreateBoundNoProxyHTTPClient("tcp4", "eth0")
// after
// run `ip link` first; if the NIC is enp3s0:
client := util.CreateBoundNoProxyHTTPClient("tcp4", "enp3s0") Defensive patterns
Strategy: validation
Validate before calling
// Go: check the interface exists before configuring the binding
ifaceName := "eth0" // value from your config
if _, err := net.InterfaceByName(ifaceName); err != nil {
log.Printf("interface %q not available, using default client", ifaceName)
// fall back to util.CreateNoProxyHTTPClient(network)
} Type guard
func interfaceExists(name string) bool {
_, err := net.InterfaceByName(name)
return err == nil
} Try / catch
// Go: the library already falls back internally; guard your own binding path
client, err := bindToInterface(cfg.IfaceName, cfg.Network) // wrapper you control
if err != nil {
log.Printf("binding to %q failed (%v), using default client", cfg.IfaceName, err)
client = util.CreateNoProxyHTTPClient(cfg.Network)
} Prevention
- Validate the configured interface name at startup with net.InterfaceByName and fail config-load fast
- Use OS-appropriate names: `ip link` on Linux, `ifconfig` on macOS, `ipconfig` on Windows
- In containers, bind to the container's interface (eth0), not the host NIC
- Re-validate the name after kernel updates or NIC renames
When it happens
Trigger: Calling CreateBoundNoProxyHTTPClient(network, ifaceName) with an interface name that is absent or misspelled (e.g. "eth0" on a system using "enp0s3" or "ens192", or "en0" on Linux); interface removed/renamed after config was written; running in a container that only has eth0 while config references a host NIC.
Common situations: Config copied from another machine; Windows/macOS interface names ("Ethernet", "en0") used on Linux or vice versa; Docker/Kubernetes environments where the host NIC is not visible; NIC renamed by predictable-network-interface-names after a kernel update.
Related errors
- get interface %s addresses failed: %v
- 找不到网卡 %s: %v
- 监听端口发生异常, 请检查端口是否被占用! %s
- 请求 dnsla 失败: %w
- 读取 dnsla 响应失败: %w
AI-assisted analysis of jeessy2/ddns-go@5874c2e666 (2026-09-03).
Data as JSON: /api/errors/49caadb96b76507b.
Report an issue: GitHub.