httpsec

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// RemoteIPTag is the tag name used for the remote HTTP request IP address.
	RemoteIPTag = "network.client.ip"
	// ClientIPTag is the tag name used for the client IP deduced from the HTTP
	// request headers with ClientIP().
	ClientIPTag = "http.client_ip"
)

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(hdrs map[string][]string, hasCanonicalHeaders bool, remoteAddr string, monitoredHeaders []string) (remoteIP, clientIP netip.Addr)

ClientIP returns the first public IP address found in the given headers. If none is present, it returns the first valid IP address present, possibly being a local IP address. The remote address, when valid, is used as fallback when no IP address has been found at all.

func ClientIPTags

func ClientIPTags(remoteIP, clientIP netip.Addr) (tags map[string]string)

ClientIPTags returns the resulting Datadog span tags `http.client_ip` containing the client IP and `network.client.ip` containing the remote IP. The tags are present only if a valid ip address has been returned by ClientIP().

Types

This section is empty.

Jump to

Keyboard shortcuts

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