mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-17 23:37:44 +00:00
seedling: Webui enhancements (#620)
* 🌱 Make sure webui starts on alpine Also drop to shell when there are no providers Signed-off-by: mudler <mudler@c3os.io> * 🌱 Suppress verbose logging on tty Signed-off-by: mudler <mudler@c3os.io> * 🌱 Print WebUI address Signed-off-by: mudler <mudler@c3os.io> * 🎨 Update banner Signed-off-by: mudler <mudler@c3os.io> * 🌱 Refactor, display also interfaces Signed-off-by: mudler <mudler@c3os.io> * 🌱 Address feedback from review Signed-off-by: mudler <mudler@c3os.io> Signed-off-by: mudler <mudler@c3os.io>
This commit is contained in:
committed by
Itxaka
parent
e15014addc
commit
cffbc3f35f
@@ -19,6 +19,8 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DefaultWebUIListenAddress = ":8080"
|
||||||
|
|
||||||
type Install struct {
|
type Install struct {
|
||||||
Auto bool `yaml:"auto,omitempty"`
|
Auto bool `yaml:"auto,omitempty"`
|
||||||
Reboot bool `yaml:"reboot,omitempty"`
|
Reboot bool `yaml:"reboot,omitempty"`
|
||||||
|
44
pkg/machine/network.go
Normal file
44
pkg/machine/network.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package machine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Interfaces() (in []string) {
|
||||||
|
ifaces, err := net.Interfaces()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, i := range ifaces {
|
||||||
|
if i.Flags == net.FlagLoopback {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
in = append(in, i.Name)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func LocalIPs() (ips []string) {
|
||||||
|
ifaces, err := net.Interfaces()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, i := range ifaces {
|
||||||
|
if i.Flags == net.FlagLoopback {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
addrs, err := i.Addrs()
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, a := range addrs {
|
||||||
|
ip, _, err := net.ParseCIDR(a.String())
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ips = append(ips, ip.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
Reference in New Issue
Block a user