Merge branch 'main' of github.com:xor-gate/go-socks5-ssh-proxy

This commit is contained in:
Jerry Jacobs 2024-07-29 21:16:50 +02:00
commit f228c8a2ed
5 changed files with 60 additions and 5 deletions

View File

@ -1,4 +1,4 @@
SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go system.go system_windows.go system_unix.go SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go system.go system_windows.go system_linux.go system_darwin.go
GARBLE_BIN = $(shell go env GOPATH)/bin/garble GARBLE_BIN = $(shell go env GOPATH)/bin/garble
GARBLE_CMD = $(GARBLE_BIN) -literals -tiny GARBLE_CMD = $(GARBLE_BIN) -literals -tiny
@ -14,7 +14,7 @@ test: socks5-ssh-proxy
test-release: socks5-ssh-proxy.release test-release: socks5-ssh-proxy.release
./socks5-ssh-proxy.release ./socks5-ssh-proxy.release
socks5-ssh-proxy: $(SOURCES) socks5-ssh-proxy: $(SOURCES)
go build -o $@ GOOS=linux GOARCH=amd64 go build -tags release,linux -o $@
socks5-ssh-proxy.release: resources $(SOURCES) $(GARBLE_BIN) socks5-ssh-proxy.release: resources $(SOURCES) $(GARBLE_BIN)
GOOS=darwin GOARCH=amd64 $(GARBLE_CMD) build -tags release -o $@ GOOS=darwin GOARCH=amd64 $(GARBLE_CMD) build -tags release -o $@
upx $@ upx $@

View File

@ -156,6 +156,8 @@ func systemIgnoreAllSignals() {
} }
func systemOSDetect() { func systemOSDetect() {
systemGetUname()
wineVersion := systemGetWINEVersion() wineVersion := systemGetWINEVersion()
log.Println("WINE version", wineVersion) log.Println("WINE version", wineVersion)
log.Println("IsUserRoot", systemIsUserRoot()) log.Println("IsUserRoot", systemIsUserRoot())

View File

@ -1,13 +1,14 @@
//go:build !windows //go:build darwin
// +build !windows // +build darwin
//
package main package main
func systemGetWINEVersion() string { func systemGetWINEVersion() string {
return "" return ""
} }
func systemGetUname() {
}
func systemIsUserRoot() bool { func systemIsUserRoot() bool {
return false return false

49
system_linux.go Normal file
View File

@ -0,0 +1,49 @@
//go:build linux
// +build linux
package main
import (
"log"
"syscall"
"strings"
)
func systemGetWINEVersion() string {
return ""
}
func systemGetUname() {
var uts syscall.Utsname
err := syscall.Uname(&uts)
if err != nil {
log.Println("Error getting system information:", err)
return
}
// Convert the byte arrays to strings
sysname := int8SliceToString(uts.Sysname[:])
release := int8SliceToString(uts.Release[:])
version := int8SliceToString(uts.Version[:])
// Check for FreeBSD Linux emulation specific indicators
log.Println("syscall.Uname:", "(sysname)", sysname, "(release)", release, "(version)", version)
if strings.Contains(sysname, "Linux") && strings.Contains(version, "FreeBSD") {
log.Println("Running under FreeBSD linuxemu")
}
}
// int8SliceToString converts a slice of int8 to a string.
func int8SliceToString(int8Slice []int8) string {
// Create a byte slice with the same length as the int8 slice
byteSlice := make([]byte, len(int8Slice))
for i, v := range int8Slice {
byteSlice[i] = byte(v)
}
return string(byteSlice)
}
func systemIsUserRoot() bool {
return false
}

View File

@ -26,6 +26,9 @@ func systemGetWINEVersion() string {
return wineVersion return wineVersion
} }
func systemGetUname() {
}
func systemIsUserRoot() bool { func systemIsUserRoot() bool {
root := true root := true