2024-01-06 05:24:11 -06:00
|
|
|
// GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
|
|
|
// Copyright (c) 2023 WIT.COM, Inc.
|
|
|
|
// This is a control panel for DNS
|
|
|
|
|
|
|
|
package linuxstatus
|
|
|
|
|
|
|
|
import (
|
2024-01-06 05:32:52 -06:00
|
|
|
"os"
|
|
|
|
"os/user"
|
2024-01-06 05:24:11 -06:00
|
|
|
"strconv"
|
2024-01-06 14:57:51 -06:00
|
|
|
"strings"
|
2024-01-06 05:24:11 -06:00
|
|
|
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func linuxLoop() {
|
|
|
|
me.changed = false
|
2024-01-06 13:55:46 -06:00
|
|
|
duration := timeFunction(lookupHostname)
|
2024-01-06 11:12:10 -06:00
|
|
|
log.Log(INFO, "getHostname() execution Time: ", duration, "me.changed =", me.changed)
|
2024-01-06 05:24:11 -06:00
|
|
|
|
|
|
|
duration = timeFunction(scanInterfaces)
|
|
|
|
log.Log(NET, "scanInterfaces() execution Time: ", duration)
|
|
|
|
for i, t := range me.ifmap {
|
|
|
|
log.Log(NET, strconv.Itoa(i) + " iface = " + t.iface.Name)
|
|
|
|
}
|
|
|
|
|
2024-01-06 14:57:51 -06:00
|
|
|
// get all the real AAAA records from all the network interfaces linux can see
|
|
|
|
tmp := strings.Join(realAAAA(), "\n")
|
|
|
|
tmp = sortLines(tmp)
|
|
|
|
me.workingIPv6.Set(tmp)
|
2024-01-06 05:24:11 -06:00
|
|
|
|
2024-01-06 05:32:52 -06:00
|
|
|
user, _ := user.Current()
|
2024-01-06 11:12:10 -06:00
|
|
|
log.Log(INFO, "os.Getuid =", user.Username, os.Getuid())
|
2024-01-06 05:32:52 -06:00
|
|
|
if (me.uid != nil) {
|
|
|
|
me.uid.Set(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
|
|
|
|
}
|
|
|
|
|
2024-01-06 05:24:11 -06:00
|
|
|
/*
|
|
|
|
processName := getProcessNameByPort(53)
|
|
|
|
fmt.Println("Process with port 53:", processName)
|
|
|
|
|
|
|
|
commPath := filepath.Join("/proc", proc.Name(), "comm")
|
|
|
|
comm, err := ioutil.ReadFile(commPath)
|
|
|
|
if err != nil {
|
|
|
|
return "", err // Error reading the process name
|
|
|
|
}
|
|
|
|
return strings.TrimSpace(string(comm)), nil
|
|
|
|
*/
|
|
|
|
}
|