https://github.com/pengzj/swift
A game server for Golang
https://github.com/pengzj/swift
game-server go server
Last synced: 21 days ago
JSON representation
A game server for Golang
- Host: GitHub
- URL: https://github.com/pengzj/swift
- Owner: pengzj
- License: apache-2.0
- Created: 2017-10-12T12:28:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-18T03:05:05.000Z (about 8 years ago)
- Last Synced: 2024-06-20T03:34:09.421Z (over 1 year ago)
- Topics: game-server, go, server
- Language: Go
- Size: 63.5 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swift
Swift is an easy to use, fast, distributed, supporting multi process multi process game server framework written by Golang.
# warning
**This framework is under development, so please don't try it at the moment.**
# how to use
````
import (
"github.com/pengzj/swift"
"./app/servers/connector/handler"
)
func main() {
app := swift.CreateApp()
app.SetConfigPath("/Users/francis.peng/Work/PfsGame/config")
app.SetLogPath("/Users/francis.peng/Project/logs/pfs")
app.HandleFunc("user.login", handler.UserLogin)
app.RegisterHandler("onChat")
app.Run()
}
````
# server config directory
**include files**:
|-- master.json
|-- servers.json
|-- secret.key
master.json
```
{
"id": "master-server-1",
"host": "127.0.0.1",
"port": "3015"
}
```
servers.json
````
[
{"type": "connector", "id": "connector-server-1","clientHost": "127.0.0.1", "clientPort": "3301", "host": "127.0.0.1", "port": "3401", "frontend": true, "connType": "tcp"},
{"type": "connector", "id": "connector-server-2","clientHost": "127.0.0.1", "clientPort": "3302", "host": "127.0.0.1", "port": "3402", "frontend": true, "connType": "tcp"},
{"type": "rank", "id": "rank-server-1","host": "127.0.0.1", "port": "3403", "frontend": false}
]
````
secret.key
````
asdfkksad$sadfk
````
# to do list
data async to db **in progress**
optimize internal interface
manage tool
service
test case
benchmark