callback

package
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeError          string = "Error"
	EventTypePlayerJoin     string = "PlayerJoin"
	EventTypePlayerLeave    string = "PlayerLeave"
	EventTypeContainerStart string = "ContainerStart"
	EventTypeContainerStop  string = "ContainerStop"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerStartEvent

type ContainerStartEvent struct {
	ProxyUID string `json:"proxyUid"`
}

func (ContainerStartEvent) EventType

func (event ContainerStartEvent) EventType() string

type ContainerStopEvent

type ContainerStopEvent struct {
	ProxyUID string `json:"proxyUid"`
}

func (ContainerStopEvent) EventType

func (event ContainerStopEvent) EventType() string

type ErrorEvent

type ErrorEvent struct {
	Error    string `json:"error"`
	ProxyUID string `json:"proxyUid"`
}

func (ErrorEvent) EventType

func (event ErrorEvent) EventType() string

type Event

type Event interface {
	EventType() string
}

type EventLog

type EventLog struct {
	Event     string      `json:"event"`
	Timestamp time.Time   `json:"timestamp"`
	Payload   interface{} `json:"payload"`
}

EventLog

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient represents an interface for the Logger to log events with.

type Logger

type Logger struct {
	URL    string
	Events []string
	// contains filtered or unexported fields
}

Logger can post events to an http endpoint

func (Logger) LogEvent

func (logger Logger) LogEvent(event Event) (*EventLog, error)

LogEvent posts the given event to an http endpoint if the Logger holds a valid URL and the Logger.Events contains given event's type.

type PlayerJoinEvent

type PlayerJoinEvent struct {
	Username      string `json:"username"`
	RemoteAddress string `json:"remoteAddress"`
	TargetAddress string `json:"targetAddress"`
	ProxyUID      string `json:"proxyUid"`
}

func (PlayerJoinEvent) EventType

func (event PlayerJoinEvent) EventType() string

type PlayerLeaveEvent

type PlayerLeaveEvent struct {
	Username      string `json:"username"`
	RemoteAddress string `json:"remoteAddress"`
	TargetAddress string `json:"targetAddress"`
	ProxyUID      string `json:"proxyUid"`
}

func (PlayerLeaveEvent) EventType

func (event PlayerLeaveEvent) EventType() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL