go_control_plane

package
v1.71.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Example (Server)
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2024 Datadog, Inc.

package main

import (
	"log"
	"net"

	"google.golang.org/grpc"

	extprocv3 "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3"
	gocontrolplane "gopkg.in/DataDog/dd-trace-go.v1/contrib/envoyproxy/go-control-plane"
)

// interface fpr external processing server
type envoyExtProcServer struct {
	extprocv3.ExternalProcessorServer
}

func main() {
	// Create a listener for the server.
	ln, err := net.Listen("tcp", ":50051")
	if err != nil {
		log.Fatal(err)
	}

	// Initialize the grpc server as normal, using the envoy server interceptor.
	s := grpc.NewServer()
	srv := &envoyExtProcServer{}

	// Register the appsec envoy external processor service
	appsecSrv := gocontrolplane.AppsecEnvoyExternalProcessorServer(srv)
	extprocv3.RegisterExternalProcessorServer(s, appsecSrv)

	// ... register your services

	// Start serving incoming connections.
	if err := s.Serve(ln); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppsecEnvoyExternalProcessorServer

func AppsecEnvoyExternalProcessorServer(userImplementation envoyextproc.ExternalProcessorServer) envoyextproc.ExternalProcessorServer

AppsecEnvoyExternalProcessorServer creates and returns a new instance of appsecEnvoyExternalProcessorServer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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