36 lines
471 B
Go
36 lines
471 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 ContainerEvent struct {
|
||
|
Type EventType
|
||
|
ID string
|
||
|
Container Container
|
||
|
}
|
||
|
|
||
|
type Container struct {
|
||
|
IP net.IP
|
||
|
Port uint16
|
||
|
Server string
|
||
|
Domain string
|
||
|
}
|