36 lines
499 B
Go
36 lines
499 B
Go
package server
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
type Agent struct {
|
|
Name string
|
|
Reg time.Time
|
|
Cores int
|
|
Cpu []int
|
|
Mem_max float64
|
|
Mem_usg []float64
|
|
TaskId int
|
|
conn *websocket.Conn
|
|
}
|
|
|
|
type Task struct {
|
|
Puzzle [9]string
|
|
Solutions [][]string
|
|
}
|
|
|
|
type Server struct {
|
|
ListenAddress string
|
|
ListenPort int
|
|
Agents map[string]*Agent
|
|
Tasks []Task
|
|
}
|
|
|
|
var upgrader = websocket.Upgrader{
|
|
ReadBufferSize: 1024,
|
|
WriteBufferSize: 1024,
|
|
}
|