Renamed package/directory
This commit is contained in:
parent
9e1cd272f7
commit
72d0843ff8
@ -10,7 +10,7 @@ import (
|
|||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/hackerbots/botserv"
|
hbserver "bitbucket.org/hackerbots/server"
|
||||||
"code.google.com/p/go.net/websocket"
|
"code.google.com/p/go.net/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,23 +42,23 @@ func main() {
|
|||||||
log.Println("serving profile info at http://localhost:8667/debug/pprof/")
|
log.Println("serving profile info at http://localhost:8667/debug/pprof/")
|
||||||
}
|
}
|
||||||
|
|
||||||
conf, err := botserv.LoadConfig(*config)
|
conf, err := hbserver.LoadConfig(*config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sm := http.NewServeMux()
|
sm := http.NewServeMux()
|
||||||
|
|
||||||
c := botserv.NewController(conf, *mprofile, *profile)
|
c := hbserver.NewController(conf, *mprofile, *profile)
|
||||||
go c.Run()
|
go c.Run()
|
||||||
|
|
||||||
sm.Handle("/", botserv.JsonHandler(c.Index))
|
sm.Handle("/", hbserver.JsonHandler(c.Index))
|
||||||
sm.Handle("/ws/", websocket.Handler(c.AddPlayer))
|
sm.Handle("/ws/", websocket.Handler(c.AddPlayer))
|
||||||
sm.Handle("/game/start/", botserv.JsonHandler(c.StartGame))
|
sm.Handle("/game/start/", hbserver.JsonHandler(c.StartGame))
|
||||||
sm.Handle("/game/list/", botserv.JsonHandler(c.ListGames))
|
sm.Handle("/game/list/", hbserver.JsonHandler(c.ListGames))
|
||||||
sm.Handle("/game/stats/", botserv.JsonHandler(c.GameStats))
|
sm.Handle("/game/stats/", hbserver.JsonHandler(c.GameStats))
|
||||||
sm.Handle("/game/bw/", botserv.JsonHandler(c.BW))
|
sm.Handle("/game/bw/", hbserver.JsonHandler(c.BW))
|
||||||
sm.Handle("/game/stop/", botserv.JsonHandler(c.StopGame))
|
sm.Handle("/game/stop/", hbserver.JsonHandler(c.StopGame))
|
||||||
sm.HandleFunc("/fuck/shit/up/", c.KillServer)
|
sm.HandleFunc("/fuck/shit/up/", c.KillServer)
|
||||||
|
|
||||||
err = http.ListenAndServe(*addr, sm)
|
err = http.ListenAndServe(*addr, sm)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -24,7 +24,7 @@ func (h JsonHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Controller is the shepherd of a collection of games. The main package in
|
// Controller is the shepherd of a collection of games. The main package in
|
||||||
// botserv simply populates one of these and starts an http server.
|
// server simply populates one of these and starts an http server.
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
Idg *IdGenerator
|
Idg *IdGenerator
|
||||||
Conf Config
|
Conf Config
|
||||||
@ -247,7 +247,7 @@ func (c *Controller) StopGame(w http.ResponseWriter, req *http.Request) {
|
|||||||
log.Printf("returning from StopGame")
|
log.Printf("returning from StopGame")
|
||||||
}
|
}
|
||||||
|
|
||||||
// KillServer is my favorite method of all the methods in botserv: it shuts
|
// KillServer is my favorite method of all the methods in server: it shuts
|
||||||
// things down respecting profiling requests.
|
// things down respecting profiling requests.
|
||||||
func (c *Controller) KillServer(w http.ResponseWriter, req *http.Request) {
|
func (c *Controller) KillServer(w http.ResponseWriter, req *http.Request) {
|
||||||
if c.Profile != "" {
|
if c.Profile != "" {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
4
doc.go
4
doc.go
@ -1,3 +1,3 @@
|
|||||||
// botserv is the collection of structs and functions used to implement
|
// server is the collection of structs and functions used to implement
|
||||||
// a hackerbots server
|
// a hackerbots server
|
||||||
package botserv
|
package server
|
||||||
|
2
id.go
2
id.go
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package botserv
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v "bitbucket.org/hackerbots/vector"
|
v "bitbucket.org/hackerbots/vector"
|
||||||
|
Loading…
Reference in New Issue
Block a user