WIP SOCKS5 proxy

This commit is contained in:
Toby
2020-04-22 13:45:25 -07:00
parent a424a17af3
commit d5640efd7e
25 changed files with 1024 additions and 214 deletions

View File

@@ -25,3 +25,15 @@ func Pipe(src, dst io.ReadWriter, atomicCounter *uint64) error {
}
}
}
func PipePair(rw1, rw2 io.ReadWriter, rw1WriteCounter, rw2WriteCounter *uint64) error {
errChan := make(chan error, 2)
go func() {
errChan <- Pipe(rw2, rw1, rw1WriteCounter)
}()
go func() {
errChan <- Pipe(rw1, rw2, rw2WriteCounter)
}()
// We only need the first error
return <-errChan
}