tlvparse

package
v0.0.0-...-d7de2fa Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Amazon's extension
	PP2_TYPE_AWS            = 0xEA
	PP2_SUBTYPE_AWS_VPCE_ID = 0x01
)
View Source
const (
	// Azure's extension
	PP2_TYPE_AZURE                           = 0xEE
	PP2_SUBTYPE_AZURE_PRIVATEENDPOINT_LINKID = 0x01
)
View Source
const (
	// pp2_tlv_ssl.client  bit fields
	PP2_BITFIELD_CLIENT_SSL       uint8 = 0x01
	PP2_BITFIELD_CLIENT_CERT_CONN       = 0x02
	PP2_BITFIELD_CLIENT_CERT_SESS       = 0x04
)

Variables

This section is empty.

Functions

func AWSVPCEndpointID

func AWSVPCEndpointID(tlv proxyproto.TLV) (string, error)

func FindAWSVPCEndpointID

func FindAWSVPCEndpointID(tlvs []proxyproto.TLV) string

FindAWSVPCEndpointID returns the first AWS VPC ID in the TLV if it exists and is well-formed.

func FindAzurePrivateEndpointLinkID

func FindAzurePrivateEndpointLinkID(tlvs []proxyproto.TLV) (uint32, bool)

FindAzurePrivateEndpointLinkID returns the first Azure Private Endpoint LinkID if it exists in the TLV collection and a boolean indicating if it was found.

func IsAWSVPCEndpointID

func IsAWSVPCEndpointID(tlv proxyproto.TLV) bool

func IsSSL

func IsSSL(t proxyproto.TLV) bool

SSLType is true if the TLV is type SSL

Types

type PP2SSL

type PP2SSL struct {
	Client uint8 // The <client> field is made of a bit field from the following values,
	// indicating which element is present: PP2_BITFIELD_CLIENT_SSL,
	// PP2_BITFIELD_CLIENT_CERT_CONN, PP2_BITFIELD_CLIENT_CERT_SESS
	Verify uint32 // Verify will be zero if the client presented a certificate
	// and it was successfully verified, and non-zero otherwise.
	TLV []proxyproto.TLV
}

2.2.5. The PP2_TYPE_SSL type and subtypes

struct pp2_tlv_ssl {
        uint8_t  client;
        uint32_t verify;
        struct pp2_tlv sub_tlv[0];
};

func FindSSL

func FindSSL(tlvs []proxyproto.TLV) (PP2SSL, bool)

SSL returns the first PP2SSL if it exists and is well formed as well as bool indicating if it was found.

func SSL

func SSL(t proxyproto.TLV) (PP2SSL, error)

SSL returns the pp2_tlv_ssl from section 2.2.5 or errors with ErrIncompatibleTLV or ErrMalformedTLV

func (PP2SSL) ClientCN

func (s PP2SSL) ClientCN() (string, bool)

ClientCN returns the string representation (in UTF8) of the Common Name field (OID: 2.5.4.3) of the client certificate's Distinguished Name and whether that extension exists.

func (PP2SSL) ClientCertConn

func (s PP2SSL) ClientCertConn() bool

ClientCertConn indicates that the client provided a certificate over the current connection.

func (PP2SSL) ClientCertSess

func (s PP2SSL) ClientCertSess() bool

ClientCertSess indicates that the client provided a certificate at least once over the TLS session this connection belongs to.

func (PP2SSL) ClientSSL

func (s PP2SSL) ClientSSL() bool

ClientSSL indicates that the client connected over SSL/TLS. When true, SSLVersion will return the version.

func (PP2SSL) SSLVersion

func (s PP2SSL) SSLVersion() (string, bool)

SSLVersion returns the US-ASCII string representation of the TLS version and whether that extension exists.

func (PP2SSL) Verified

func (s PP2SSL) Verified() bool

Verified is true if the client presented a certificate and it was successfully verified

Jump to

Keyboard shortcuts

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