Added Local IPv4 address support
This commit is contained in:
parent
0fd198d83e
commit
e8a95e5313
@ -34,6 +34,7 @@ for i in $(seq ${MOUNTED_PARTITIONS}); do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo -e "${C3}Local IPv4 Address: ${C4}${LOCAL_IPV4}"
|
||||||
if [ ! -z "$DISPLAY_PROTOCOL" ]; then
|
if [ ! -z "$DISPLAY_PROTOCOL" ]; then
|
||||||
echo -e "${C3}Display Protocol: ${C4}${DISPLAY_PROTOCOL}"
|
echo -e "${C3}Display Protocol: ${C4}${DISPLAY_PROTOCOL}"
|
||||||
for i in $(seq ${CONNECTED_MONITORS}); do
|
for i in $(seq ${CONNECTED_MONITORS}); do
|
||||||
|
1
main.go
1
main.go
@ -167,6 +167,7 @@ func SetupFetchEnv(showTimeTaken bool) []string {
|
|||||||
setVariable("DISPLAY_PROTOCOL", func() string { return GetDisplayProtocol() })
|
setVariable("DISPLAY_PROTOCOL", func() string { return GetDisplayProtocol() })
|
||||||
setVariable("LIBC", func() string { return GetLibc() })
|
setVariable("LIBC", func() string { return GetLibc() })
|
||||||
setVariable("INIT_SYSTEM", func() string { return GetInitSystem() })
|
setVariable("INIT_SYSTEM", func() string { return GetInitSystem() })
|
||||||
|
setVariable("LOCAL_IPV4", func() string { return GetLocalIP() })
|
||||||
start = time.Now().UnixMilli()
|
start = time.Now().UnixMilli()
|
||||||
monitors := getMonitorResolution()
|
monitors := getMonitorResolution()
|
||||||
end = time.Now().UnixMilli()
|
end = time.Now().UnixMilli()
|
||||||
|
13
utils.go
13
utils.go
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/moby/sys/mountinfo"
|
"github.com/moby/sys/mountinfo"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
@ -440,6 +441,18 @@ func GetLibc() string {
|
|||||||
return "Musl " + strings.TrimSpace(string(bytes))
|
return "Musl " + strings.TrimSpace(string(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetLocalIP() string {
|
||||||
|
conn, err := net.Dial("udp", "8.8.8.8:80")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
|
||||||
|
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
||||||
|
|
||||||
|
return localAddr.IP.String()
|
||||||
|
}
|
||||||
|
|
||||||
func FormatBytes(bytes uint64) string {
|
func FormatBytes(bytes uint64) string {
|
||||||
var suffixes [6]string
|
var suffixes [6]string
|
||||||
suffixes[0] = "B"
|
suffixes[0] = "B"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user