mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
docs: Add 'host' parameter
This commit is contained in:
parent
72c02fc398
commit
45af07d08b
@ -24,7 +24,10 @@ import (
|
||||
"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() {
|
||||
flag.Parse()
|
||||
@ -39,6 +42,10 @@ func init() {
|
||||
|
||||
func main() {
|
||||
http.Handle("/", http.FileServer(http.Dir(rootPath)))
|
||||
fmt.Printf("http://localhost:%d/\n", *port)
|
||||
log.Fatal(http.ListenAndServe("localhost:"+strconv.Itoa(*port), nil))
|
||||
if *host == "" {
|
||||
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