NUtSAK is a network utility library. Included is a client offering similar features to socat.
Open a terminal and run the following:
$ go get -u github.com/mjwhitta/nutsak
$ go install github.com/mjwhitta/nutsak/cmd/sak@latest
Or compile from source:
$ git clone https://github.com/mjwhitta/nutsak.git
$ cd nutsak
$ git submodule update --init
$ make
To create a simple TCP listener:
$ sak tcp-listen:4444,fork stdout
To create a simple TCP client:
$ sak stdin tcp:4444
package main
import (
"time"
sak "github.com/mjwhitta/nutsak"
)
func main() {
var a sak.NUt
var b sak.NUt
var e error
// Create first NUt
if a, e = sak.NewNUt("tcp-listen:4444,fork"); e != nil {
panic(e)
}
// Create second NUt
if b, e = sak.NewNUt("stdout"); e != nil {
panic(e)
}
// Shutdown in 10 seconds
go func() {
time.Sleep(10 * time.Second)
a.Down()
b.Down()
}()
// Pair NUts to create two-way tunnel
if e = sak.Pair(a, b); e != nil {
panic(e)
}
}
- Fix compiling for Windows
- Improve TCP/TLS fork option
- EXEC process support
- HTTP proxy support