Documentation
¶
Overview ¶
Example (Server) ¶
// Create a listener for the server.
ln, err := net.Listen("tcp4", "127.0.0.1:3000")
if err != nil {
log.Fatal(err)
}
// Initialize the SPOA agent server with the configuration
appsecHAProxy := NewHAProxySPOA(AppsecHAProxyConfig{
BlockingUnavailable: false,
BodyParsingSizeLimit: 1000000, // 1MB
Context: context.Background(),
})
a := agent.New(appsecHAProxy.Handler, logger.NewDefaultLog())
// Start serving incoming connections.
if err := a.Serve(ln); err != nil {
log.Fatalf("failed to serve: %v", err)
}
Index ¶
Examples ¶
Constants ¶
const ( VarIp = "ip" // The remote IP address of the client as net.IP VarIpPort = "ip_port" // The remote port of the client as an int. VarMethod = "method" // The HTTP method of the request as a string. VarPath = "path" // The path of the request as a string. VarHeaders = "headers" // The binary headers of the request as a []byte. VarHttps = "https" // The request is HTTPS as a bool. VarTimeout = "timeout" // The timeout duration of the request as a string. VarStatus = "status" // The status code of the response as an int. VarBody = "body" // The body of the request as a []byte. VarSpanId = "span_id" // The span ID of the request as a string. VarBlocked = "blocked" // The request is blocked as a bool. VarRequestBody = "request_body" // The body of the request or response is requested by the SPOA, as a bool. VarTracingHeaderTraceId = "tracing_x_datadog_trace_id" // The Datadog trace ID header of the request as a string. VarTracingHeaderParentId = "tracing_x_datadog_parent_id" // The Datadog parent ID header of the request as a string. VarTracingHeaderOrigin = "tracing_x_datadog_origin" // The Datadog origin header of the request as a string. VarTracingHeaderSamplingPriority = "tracing_x_datadog_sampling_priority" // The Datadog sampling priority header of the request as a string. VarTracingHeaderTags = "tracing_x_datadog_tags" // The Datadog tags header of the request as a string. MessageHTTPRequestHeaders = "http-request-headers-msg" // SPOE message name for request headers MessageHTTPRequestBody = "http-request-body-msg" // SPOE message name for request body MessageHTTPResponseHeaders = "http-response-headers-msg" // SPOE message name for response headers MessageHTTPResponseBody = "http-response-body-msg" // SPOE message name for response body )
The following constants define the variable or message names used for communication between the Go SPOA agent and HAProxy, based on the SPOE configuration. IMPORTANT: If you change any of these values, you MUST also update the corresponding names in the HAProxy configuration to match, or the integration will break.
Variables ¶
This section is empty.
Functions ¶
func Instrumentation ¶
func Instrumentation() *instrumentation.Instrumentation
Instrumentation returns the instrumentation.Instrumentation package instrumentation
Types ¶
type AppsecHAProxyConfig ¶
AppsecHAProxyConfig contains configuration for the AppSec HAProxy Stream Processing Offload Agent
type HAProxySPOA ¶
type HAProxySPOA struct {
// contains filtered or unexported fields
}
HAProxySPOA defines the AppSec HAProxy Stream Processing Offload Agent
func NewHAProxySPOA ¶
func NewHAProxySPOA(config AppsecHAProxyConfig) *HAProxySPOA
NewHAProxySPOA creates a new AppSec HAProxy Stream Processing Offload Agent
func (*HAProxySPOA) Handler ¶
func (s *HAProxySPOA) Handler(req *request.Request)
Handler processes Stream Processing Offload messages from HAProxy