quic

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MPL-2.0, BSD-3-Clause Imports: 17 Imported by: 0

README

The code here is from https://github.com/cuonglm/quicsni with various modifications.

Documentation

Index

Constants

View Source
const (
	V1 uint32 = 0x1
	V2 uint32 = 0x6b3343cf
)

Variables

This section is empty.

Functions

func ReadCryptoPayload

func ReadCryptoPayload(packet []byte) ([]byte, error)

Types

type Header struct {
	Type             uint8
	Version          uint32
	SrcConnectionID  []byte
	DestConnectionID []byte
	Length           int64
	Token            []byte
}

The Header represents a QUIC header.

func ParseInitialHeader

func ParseInitialHeader(data []byte) (*Header, int64, error)

ParseInitialHeader parses the initial packet of a QUIC connection, return the initial header and number of bytes read so far.

type PacketProtector

type PacketProtector struct {
	// contains filtered or unexported fields
}

PacketProtector is used for protecting a QUIC packet.

See: https://www.rfc-editor.org/rfc/rfc9001.html#name-packet-protection

func NewPacketProtector

func NewPacketProtector(key *ProtectionKey) *PacketProtector

NewPacketProtector creates a new PacketProtector.

func (*PacketProtector) UnProtect

func (pp *PacketProtector) UnProtect(packet []byte, pnOffset, pnMax int64) ([]byte, error)

UnProtect decrypts a QUIC packet.

type ProtectionKey

type ProtectionKey struct {
	// contains filtered or unexported fields
}

ProtectionKey is the key used to protect a QUIC packet.

func NewInitialProtectionKey

func NewInitialProtectionKey(secret []byte, v uint32) (*ProtectionKey, error)

NewInitialProtectionKey is like NewProtectionKey, but the returned protection key is used for encrypt/decrypt Initial Packet only.

See: https://datatracker.ietf.org/doc/html/draft-ietf-quic-tls-32#name-initial-secrets

func NewProtectionKey

func NewProtectionKey(suite uint16, secret []byte, v uint32) (*ProtectionKey, error)

NewProtectionKey creates a new ProtectionKey.

Jump to

Keyboard shortcuts

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