Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callbacks ¶
type Callbacks interface { // OnConnecting is called when there is a new incoming connection. // The handler can examine the request and either accept or reject the connection. // To accept: // Return ConnectionResponse with Accept=true. // HTTPStatusCode and HTTPResponseHeader are ignored. // // To reject: // Return ConnectionResponse with Accept=false. HTTPStatusCode MUST be set to // non-zero value to indicate the rejection reason (typically 401, 429 or 503). // HTTPResponseHeader may be optionally set (e.g. "Retry-After: 30"). OnConnecting(request *http.Request) ConnectionResponse // OnConnected is called when and incoming OpAMP connection is successfully // established after OnConnecting() returns. OnConnected(conn Connection) // OnMessage is called when a message is received from the connection. Can happen // only after OnConnected(). Must return a ServerToAgent message that will be sent // as a response to the Agent. // For plain HTTP requests once OnMessage returns and the response is sent // to the Agent the OnConnectionClose message will be called immediately. OnMessage(conn Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent // OnConnectionClose is called when the OpAMP connection is closed. OnConnectionClose(conn Connection) }
type Connection ¶
type Connection interface { // RemoteAddr returns the remote network address of the connection. RemoteAddr() net.Addr // Send a message. Should not be called concurrently for the same Connection instance. // Can be called only for WebSocket connections. Will return an error for plain HTTP // connections. // Blocks until the message is sent. // Should return as soon as possible if the ctx is cancelled. Send(ctx context.Context, message *protobufs.ServerToAgent) error }
Connection represents one OpAMP connection. The implementation MUST be a comparable type so that it can be used as a map key.
Click to show internal directories.
Click to hide internal directories.