Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/util/net/net_interfaces.go

23 lines
521 B

package net
import (
"fmt"
"net"
)
// LoopbackInterfaceName search for the name of a loopback interface in the list
// of the system's network interfaces and returns the first one found.
func LoopbackInterfaceName() (string, error) {
is, err := net.Interfaces()
if err != nil {
return "", fmt.Errorf("can't retrieve loopback interface name: %s", err)
}
for _, i := range is {
if i.Flags&net.FlagLoopback != 0 {
return i.Name, nil
}
}
return "", fmt.Errorf("can't retrieve loopback interface name")
}