forked from quic-go/quic-go
add command line option which address to bind to
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@@ -31,8 +32,10 @@ func main() {
|
|||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte("Hello world!"))
|
w.Write([]byte("Hello world!"))
|
||||||
})
|
})
|
||||||
|
bindTo := flag.String("bind", "localhost", "bind to")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
err = server.ListenAndServe("localhost:6121")
|
err = server.ListenAndServe(*bindTo + ":6121")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user