Cleanup
This commit is contained in:
parent
50380415b9
commit
adc1e2af5f
|
@ -28,7 +28,6 @@ The trafficserver is basically a Websocket server pushing traffic data to any co
|
||||||
|
|
||||||
```
|
```
|
||||||
Usage of ./bin/realtimetraffic:
|
Usage of ./bin/realtimetraffic:
|
||||||
-client="./client": Path to client directory.
|
|
||||||
-listen="127.0.0.1:8088": Listen address.
|
-listen="127.0.0.1:8088": Listen address.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import (
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
var staticPath *string
|
|
||||||
var listenAddr *string
|
var listenAddr *string
|
||||||
|
|
||||||
func serveClient(w http.ResponseWriter, r *http.Request) {
|
func serveClient(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -69,22 +68,15 @@ func serveWs(w http.ResponseWriter, r *http.Request) {
|
||||||
func main() {
|
func main() {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
staticPath = flag.String("client", "", "Full path to client directory.")
|
|
||||||
listenAddr = flag.String("listen", "127.0.0.1:8088", "Listen address.")
|
listenAddr = flag.String("listen", "127.0.0.1:8088", "Listen address.")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
go h.run()
|
go h.run()
|
||||||
http.HandleFunc("/", serveClient)
|
http.HandleFunc("/", serveClient)
|
||||||
http.HandleFunc("/realtimetraffic", serveWs)
|
http.HandleFunc("/realtimetraffic", serveWs)
|
||||||
/*http.Handle("/css/", http.FileServer(http.Dir(*client)))
|
|
||||||
http.Handle("/scripts/", http.FileServer(http.Dir(*client)))
|
|
||||||
http.Handle("/img/", http.FileServer(http.Dir(*client)))
|
|
||||||
http.Handle("/favicon.ico", http.FileServer(http.Dir(*client)))
|
|
||||||
*/
|
|
||||||
|
|
||||||
err = http.ListenAndServe(*listenAddr, nil)
|
err = http.ListenAndServe(*listenAddr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("ListenAndServe: ", err)
|
log.Fatal("ListenAndServe: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue