server
This commit is contained in:
31
cmd/monkey-server/main.go
Normal file
31
cmd/monkey-server/main.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
)
|
||||
|
||||
var (
|
||||
bind string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&bind, "b", ":8000", "[interface]:<port> to bind to")
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
|
||||
defer stop()
|
||||
|
||||
svr, err := server.NewServer(server.WithBind(bind))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Fatal(svr.Run(ctx))
|
||||
}
|
||||
Reference in New Issue
Block a user