mirror of
https://github.com/kairos-io/provider-kairos.git
synced 2025-09-26 15:15:06 +00:00
26 lines
460 B
Go
26 lines
460 B
Go
![]() |
package role
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"net"
|
||
|
|
||
|
providerConfig "github.com/kairos-io/provider-kairos/internal/provider/config"
|
||
|
)
|
||
|
|
||
|
func guessInterface(pconfig *providerConfig.Config) string {
|
||
|
if pconfig.KubeVIP.Interface != "" {
|
||
|
return pconfig.KubeVIP.Interface
|
||
|
}
|
||
|
ifaces, err := net.Interfaces()
|
||
|
if err != nil {
|
||
|
fmt.Println("failed getting system interfaces")
|
||
|
return ""
|
||
|
}
|
||
|
for _, i := range ifaces {
|
||
|
if i.Name != "lo" {
|
||
|
return i.Name
|
||
|
}
|
||
|
}
|
||
|
return ""
|
||
|
}
|