X-Git-Url: http://git.scottworley.com/reliable-chat/blobdiff_plain/4565c41c58daff52300e281a4ac63cd73e9c660a..270d2ae5829e1d66dcc1a0fb78ba3c2e3c3c22de:/server/server.go?ds=sidebyside diff --git a/server/server.go b/server/server.go index 1bb7c9a..adbbf84 100644 --- a/server/server.go +++ b/server/server.go @@ -27,6 +27,7 @@ import "strconv" import "time" var port = flag.Int("port", 21059, "Port to listen on") +var localaddress = flag.String("localaddress", "", "Local address to bind to") var frame_count = expvar.NewInt("frame_count") var speak_count = expvar.NewInt("speak_count") @@ -156,6 +157,10 @@ const frame_html = ` ` +const robots_txt = `User-agent: * +Disallow: / +` + func start_server(store Store) { http.HandleFunc("/fetch", func(w http.ResponseWriter, r *http.Request) { var since time.Time @@ -195,7 +200,11 @@ func start_server(store Store) { w.Write([]byte(frame_html)); }) - log.Fatal(http.ListenAndServe(":"+strconv.Itoa(*port), nil)) + http.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(robots_txt)); + }) + + log.Fatal(http.ListenAndServe(*localaddress+":"+strconv.Itoa(*port), nil)) } func main() {