shad-go/firewall/cmd/service/main.go

25 lines
429 B
Go
Raw Normal View History

2022-02-10 22:06:57 +00:00
//go:build !change
2020-04-02 19:25:32 +00:00
package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
)
func main() {
port := flag.String("port", "", "port to listen")
flag.Parse()
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, _ = io.Copy(w, r.Body)
defer func() { _ = r.Body.Close() }()
w.Header().Set("Content-Length", fmt.Sprintf("%d", r.ContentLength))
})
log.Fatal(http.ListenAndServe(":"+*port, nil))
}