42 lines
535 B
Go
42 lines
535 B
Go
package model
|
|
|
|
import "net"
|
|
|
|
type EventType uint8
|
|
|
|
const (
|
|
EventStart EventType = iota
|
|
EventStop
|
|
EventUnknown
|
|
)
|
|
|
|
func TypeFromAction(action string) EventType {
|
|
switch action {
|
|
case "start":
|
|
return EventStart
|
|
case "stop", "die":
|
|
return EventStop
|
|
default:
|
|
return EventUnknown
|
|
}
|
|
}
|
|
|
|
type Event struct {
|
|
Type EventType
|
|
ID string
|
|
Container Container
|
|
}
|
|
|
|
type EventRequest struct {
|
|
ID string
|
|
Error string
|
|
}
|
|
|
|
type Container struct {
|
|
IP net.IP
|
|
Port uint16
|
|
Server string
|
|
Prefix string
|
|
Domain string
|
|
}
|