47 lines
749 B
Go
47 lines
749 B
Go
package dto
|
|
|
|
import "net"
|
|
|
|
type EventType uint8
|
|
|
|
const (
|
|
EventStart EventType = iota
|
|
EventStop
|
|
EventShutdown
|
|
EventError
|
|
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
|
|
Container Container
|
|
}
|
|
|
|
type EventStatus struct {
|
|
Type EventType
|
|
ID string
|
|
Error string
|
|
Domain string
|
|
}
|
|
|
|
type Container struct {
|
|
ID string `json:"id"`
|
|
Names []string `json:"names"`
|
|
IP net.IP `json:"ip"`
|
|
Port uint16 `json:"port"`
|
|
Server string `json:"-"`
|
|
RemoteHost string `json:"remote_host"`
|
|
Domain string `json:"domain"`
|
|
}
|