use os.Stdin to read the pastebin text (#379)

This commit is contained in:
Michael Quigley
2023-07-27 14:31:15 -04:00
parent 6eddcedb32
commit 33a8088377
2 changed files with 15 additions and 2 deletions

View File

@ -4,13 +4,24 @@ import (
"fmt"
"github.com/openziti/zrok/environment"
"github.com/openziti/zrok/sdk"
"io"
"net"
"os"
"os/signal"
"syscall"
)
const MAX_PASTE_SIZE = 64 * 1024
var data []byte
func main() {
var err error
data, err = io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}
root, err := environment.LoadRoot()
if err != nil {
panic(err)
@ -53,7 +64,7 @@ func main() {
}
func handle(conn net.Conn) {
_, err := conn.Write([]byte("hello from pastebin"))
_, err := conn.Write(data)
if err != nil {
fmt.Printf("error: %v\n", err)
}