mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-27 12:52:27 +02:00
refactor: move client info handling to desktop-specific files
Move client information related functions from client_info_*.go to desktop_*.go files to better organize platform-specific code and separate desktop functionality from shared code. No functional changes.
This commit is contained in:
committed by
Cuong Manh Le
parent
abad9ef8d4
commit
7ec4353d90
@@ -1,4 +0,0 @@
|
|||||||
package ctrld
|
|
||||||
|
|
||||||
// SelfDiscover reports whether ctrld should only do self discover.
|
|
||||||
func SelfDiscover() bool { return true }
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
//go:build !windows && !darwin
|
|
||||||
|
|
||||||
package ctrld
|
|
||||||
|
|
||||||
// SelfDiscover reports whether ctrld should only do self discover.
|
|
||||||
func SelfDiscover() bool { return false }
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package ctrld
|
|
||||||
|
|
||||||
import (
|
|
||||||
"golang.org/x/sys/windows"
|
|
||||||
)
|
|
||||||
|
|
||||||
// isWindowsWorkStation reports whether ctrld was run on a Windows workstation machine.
|
|
||||||
func isWindowsWorkStation() bool {
|
|
||||||
// From https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa
|
|
||||||
const VER_NT_WORKSTATION = 0x0000001
|
|
||||||
osvi := windows.RtlGetVersion()
|
|
||||||
return osvi.ProductType == VER_NT_WORKSTATION
|
|
||||||
}
|
|
||||||
|
|
||||||
// SelfDiscover reports whether ctrld should only do self discover.
|
|
||||||
func SelfDiscover() bool {
|
|
||||||
return isWindowsWorkStation()
|
|
||||||
}
|
|
||||||
@@ -5,3 +5,6 @@ package ctrld
|
|||||||
func IsDesktopPlatform() bool {
|
func IsDesktopPlatform() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SelfDiscover reports whether ctrld should only do self discover.
|
||||||
|
func SelfDiscover() bool { return true }
|
||||||
|
|||||||
@@ -7,3 +7,6 @@ package ctrld
|
|||||||
func IsDesktopPlatform() bool {
|
func IsDesktopPlatform() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SelfDiscover reports whether ctrld should only do self discover.
|
||||||
|
func SelfDiscover() bool { return false }
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
package ctrld
|
package ctrld
|
||||||
|
|
||||||
|
import "golang.org/x/sys/windows"
|
||||||
|
|
||||||
// IsDesktopPlatform indicates if ctrld is running on a desktop platform,
|
// IsDesktopPlatform indicates if ctrld is running on a desktop platform,
|
||||||
// currently defined as macOS or Windows workstation.
|
// currently defined as macOS or Windows workstation.
|
||||||
func IsDesktopPlatform() bool {
|
func IsDesktopPlatform() bool {
|
||||||
return isWindowsWorkStation()
|
return isWindowsWorkStation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SelfDiscover reports whether ctrld should only do self discover.
|
||||||
|
func SelfDiscover() bool {
|
||||||
|
return isWindowsWorkStation()
|
||||||
|
}
|
||||||
|
|
||||||
|
// isWindowsWorkStation reports whether ctrld was run on a Windows workstation machine.
|
||||||
|
func isWindowsWorkStation() bool {
|
||||||
|
// From https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa
|
||||||
|
const VER_NT_WORKSTATION = 0x0000001
|
||||||
|
osvi := windows.RtlGetVersion()
|
||||||
|
return osvi.ProductType == VER_NT_WORKSTATION
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user