engine

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(source *workloadapi.X509Source, serverStarted chan<- bool) error

Serve initializes and starts an mTLS-secured HTTP server using the given X509Source and TLS configuration. It also signals that the server has started by sending a message on the provided channel.

Parameters:

  • source: A pointer to workloadapi.X509Source, which provides X.509 SVIDs for mTLS.
  • serverStarted: A channel that will receive a boolean value to signal server startup.

Returns:

  • error: An error object if the server fails to start or run; otherwise, returns nil.

The function performs the following operations:

  1. Validates the source and initializes routes.
  2. Sets up a custom authorizer using the TLS configuration.
  3. Configures and starts the HTTP server with mTLS enabled.
  4. Signals server startup by sending a boolean value on the `serverStarted` channel.
  5. Listens and serves incoming HTTP requests.

The function will return an error if any of the following conditions occur:

  • The source is nil.
  • Server fails to listen and serve.

Note: Serve should be called only once during the application lifecycle to initialize the HTTP server.

Types

This section is empty.

Jump to

Keyboard shortcuts

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