mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 10:42:42 +01:00
docs: Add 'host' parameter
This commit is contained in:
parent
72c02fc398
commit
45af07d08b
@ -24,7 +24,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
var port = flag.Int("port", 8000, "port number")
|
var (
|
||||||
|
host = flag.String("host", "", "host name")
|
||||||
|
port = flag.Int("port", 8000, "port number")
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@ -39,6 +42,10 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.Handle("/", http.FileServer(http.Dir(rootPath)))
|
http.Handle("/", http.FileServer(http.Dir(rootPath)))
|
||||||
fmt.Printf("http://localhost:%d/\n", *port)
|
if *host == "" {
|
||||||
log.Fatal(http.ListenAndServe("localhost:"+strconv.Itoa(*port), nil))
|
fmt.Printf("http://127.0.0.1:%d/\n", *port)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("http://%s:%d/\n", *host, *port)
|
||||||
|
}
|
||||||
|
log.Fatal(http.ListenAndServe(*host+":"+strconv.Itoa(*port), nil))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user