packet

package
v0.12.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TLSMaxPayloadLen uint16         = 16384 // 16 KB
	TLSHeaderLen                    = 5
	TLSHandshake     TLSMessageType = 0x16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpRequest

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

func ReadHttpRequest

func ReadHttpRequest(rdr io.Reader) (*HttpRequest, error)

ReadHttpRequest reads an HTTP request from the provided io.Reader.

func (*HttpRequest) Domain

func (p *HttpRequest) Domain() string

func (*HttpRequest) IsConnectMethod

func (p *HttpRequest) IsConnectMethod() bool

IsConnectMethod checks if the HTTP method is CONNECT.

func (*HttpRequest) IsValidMethod

func (p *HttpRequest) IsValidMethod() bool

IsValidMethod checks if the HTTP method is valid.

func (*HttpRequest) Method

func (p *HttpRequest) Method() string

func (*HttpRequest) Port

func (p *HttpRequest) Port() string

func (*HttpRequest) Raw

func (p *HttpRequest) Raw() []byte

func (*HttpRequest) Tidy

func (p *HttpRequest) Tidy()

Tidy removes unnecessary headers and tidies up the HTTP request.

func (*HttpRequest) Version

func (p *HttpRequest) Version() string

type TLSHeader

type TLSHeader struct {
	Type         TLSMessageType
	ProtoVersion uint16 // major | minor
	PayloadLen   uint16
}

type TLSMessage

type TLSMessage struct {
	Header     TLSHeader
	Raw        []byte //Header + Payload
	RawHeader  []byte
	RawPayload []byte
}

func ReadTLSMessage

func ReadTLSMessage(r io.Reader) (*TLSMessage, error)

ReadTLSMessage reads a TLS message from the provided io.Reader.

func (*TLSMessage) IsClientHello

func (m *TLSMessage) IsClientHello() bool

IsClientHello checks if the TLS message is a Client Hello message. According to RFC 8446 Section 4: TLS handshake message type 0x01 means "client_hello".

type TLSMessageType

type TLSMessageType byte

Jump to

Keyboard shortcuts

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