This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tab autocomplete and stability changes
NO MORE RACE CONDITION LOL
- Loading branch information
Showing
14 changed files
with
340 additions
and
101 deletions.
There are no files selected for viewing
Binary file modified
BIN
+3.44 KB
(120%)
client/UserInterface/widgets/__pycache__/agent.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+198 Bytes
(100%)
client/UserInterface/widgets/__pycache__/winton.cpython-311.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"runtime" | ||
|
||
) | ||
|
||
func fallback() (string) { | ||
addrs, err := net.InterfaceAddrs() | ||
if err != nil { | ||
return "-" | ||
} | ||
|
||
for _, addr := range addrs { | ||
ipNet, ok := addr.(*net.IPNet) | ||
if ok && !ipNet.IP.IsLoopback() { | ||
if ipNet.IP.To4() != nil { | ||
return ipNet.IP.String() | ||
} | ||
} | ||
} | ||
|
||
return "-" | ||
} | ||
|
||
func GetInternalIP() (string, error) { | ||
interfaces, err := net.Interfaces() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
for _, iface := range interfaces { | ||
if iface.Name == "Ethernet" { | ||
addrs, err := iface.Addrs() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
for _, addr := range addrs { | ||
ipNet, ok := addr.(*net.IPNet) | ||
if ok && !ipNet.IP.IsLoopback() { | ||
if ipNet.IP.To4() != nil { | ||
return ipNet.IP.String(), nil | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return fallback(), nil | ||
} | ||
|
||
func GetSystemInfo() string { | ||
os := runtime.GOOS | ||
arch := runtime.GOARCH | ||
|
||
switch os { | ||
case "darwin": | ||
os = "macOS" | ||
case "windows": | ||
os = "Windows" | ||
case "linux": | ||
os = "Linux" | ||
} | ||
|
||
switch arch { | ||
case "amd64": | ||
arch = "x64" | ||
case "386": | ||
arch = "x86" | ||
} | ||
|
||
return fmt.Sprintf("%s (%s)", os, arch) | ||
} | ||
|
||
func main() { | ||
ip, err := GetInternalIP() | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
fmt.Println(ip) | ||
|
||
OS := GetSystemInfo() | ||
fmt.Println(OS) | ||
} |
Oops, something went wrong.