mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-04-29 19:01:42 +02:00
fix: improvements in memory consumption (#100)
* fix: must close the connection after processing I think it should help to close #80 * feat: migration to github.com/things-go/go-socks5 - preallocate config slices - not used interfaces in consumer - do not allocate new variables in loops * feat: close connection after full processing * feat: correct process sigint signal * feat: improve build system * fix: http proxy * feat: update golangci-lint-action to v3.7.0 * feat: correct process routines * fix: close http conn correctly * feat: update golangci-lint-action to v4 * fix: goreleaser used clean now
This commit is contained in:
parent
49f568810c
commit
a2d7aecb6f
12 changed files with 205 additions and 140 deletions
|
@ -1,14 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/akamensky/argparse"
|
||||
"github.com/octeep/wireproxy"
|
||||
"github.com/pufferffish/wireproxy"
|
||||
"golang.zx2c4.com/wireguard/device"
|
||||
"suah.dev/protect"
|
||||
)
|
||||
|
@ -46,6 +48,15 @@ func executablePath() string {
|
|||
}
|
||||
|
||||
func main() {
|
||||
s := make(chan os.Signal, 1)
|
||||
signal.Notify(s, syscall.SIGINT, syscall.SIGQUIT)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
go func() {
|
||||
<-s
|
||||
cancel()
|
||||
}()
|
||||
|
||||
exePath := executablePath()
|
||||
unveilOrPanic("/", "r")
|
||||
unveilOrPanic(exePath, "x")
|
||||
|
@ -138,5 +149,5 @@ func main() {
|
|||
go spawner.SpawnRoutine(tnet)
|
||||
}
|
||||
|
||||
select {} // sleep eternally
|
||||
<-ctx.Done()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue