hack

package
v1.2.12-finch Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package hack includes wraps and hacks of Go net stack.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompleteClientHello = errors.New("incomplete client hello")
)

Functions

This section is empty.

Types

type ChannelListener

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

func NewChannelListener

func NewChannelListener(ctx context.Context) *ChannelListener

func (*ChannelListener) Accept

func (ln *ChannelListener) Accept() (net.Conn, error)

func (*ChannelListener) Addr

func (ln *ChannelListener) Addr() net.Addr

func (*ChannelListener) Close

func (ln *ChannelListener) Close() error

func (*ChannelListener) SendToChannel

func (ln *ChannelListener) SendToChannel(conn net.Conn)

type HTTP1HeaderConn

type HTTP1HeaderConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewHTTP1HeaderConn

func NewHTTP1HeaderConn(conn net.Conn) (*HTTP1HeaderConn, error)

NewHTTP1HeaderConn reads from conn until the end of the HTTP/1.x header block (\r\n\r\n) and returns a connection that replays those bytes and exposes the ordered header names.

func (*HTTP1HeaderConn) Close

func (c *HTTP1HeaderConn) Close() error

Close closes the underlying connection, which will trigger Done() for TLSClientHelloConn

func (*HTTP1HeaderConn) OrderedHeaders

func (c *HTTP1HeaderConn) OrderedHeaders() []string

func (*HTTP1HeaderConn) Read

func (c *HTTP1HeaderConn) Read(b []byte) (int, error)

type HTTP1HeaderListener

type HTTP1HeaderListener struct{ net.Listener }

HTTP1HeaderListener wraps an existing listener and returns connections that record HTTP/1.x header order.

func NewHTTP1HeaderListener

func NewHTTP1HeaderListener(inner net.Listener) *HTTP1HeaderListener

func (*HTTP1HeaderListener) Accept

func (l *HTTP1HeaderListener) Accept() (net.Conn, error)

Accept waits for and returns the next connection to the listener. It wraps accepted connections with HTTP1HeaderConn to capture the order of HTTP/1.x headers. If the client closes the connection before sending a complete request (resulting in io.EOF or io.ErrUnexpectedEOF) or times out while sending headers, the connection is discarded and Accept continues to wait for the next one instead of returning an error up the stack which would stop the HTTP server.

type HijackClientHelloConn

type HijackClientHelloConn struct {

	// verbose log func
	VerboseLogFunc func(string, ...any)
	// contains filtered or unexported fields
}

func NewHijackClientHelloConn

func NewHijackClientHelloConn(conn net.Conn) *HijackClientHelloConn

func (*HijackClientHelloConn) Close

func (c *HijackClientHelloConn) Close() error

func (*HijackClientHelloConn) GetClientHello

func (c *HijackClientHelloConn) GetClientHello() ([]byte, error)

func (*HijackClientHelloConn) LocalAddr

func (c *HijackClientHelloConn) LocalAddr() net.Addr

func (*HijackClientHelloConn) Read

func (c *HijackClientHelloConn) Read(b []byte) (int, error)

func (*HijackClientHelloConn) RemoteAddr

func (c *HijackClientHelloConn) RemoteAddr() net.Addr

func (*HijackClientHelloConn) SetDeadline

func (c *HijackClientHelloConn) SetDeadline(t time.Time) error

func (*HijackClientHelloConn) SetReadDeadline

func (c *HijackClientHelloConn) SetReadDeadline(t time.Time) error

func (*HijackClientHelloConn) SetWriteDeadline

func (c *HijackClientHelloConn) SetWriteDeadline(t time.Time) error

func (*HijackClientHelloConn) Write

func (c *HijackClientHelloConn) Write(b []byte) (n int, err error)

type TLSClientHelloConn

type TLSClientHelloConn struct {
	Conn              *tls.Conn
	ClientHelloRecord []byte
	Done              context.CancelFunc
}

func (*TLSClientHelloConn) Close

func (c *TLSClientHelloConn) Close() error

func (*TLSClientHelloConn) LocalAddr

func (c *TLSClientHelloConn) LocalAddr() net.Addr

func (*TLSClientHelloConn) Read

func (c *TLSClientHelloConn) Read(b []byte) (n int, err error)

func (*TLSClientHelloConn) RemoteAddr

func (c *TLSClientHelloConn) RemoteAddr() net.Addr

func (*TLSClientHelloConn) SetDeadline

func (c *TLSClientHelloConn) SetDeadline(t time.Time) error

func (*TLSClientHelloConn) SetReadDeadline

func (c *TLSClientHelloConn) SetReadDeadline(t time.Time) error

func (*TLSClientHelloConn) SetWriteDeadline

func (c *TLSClientHelloConn) SetWriteDeadline(t time.Time) error

func (*TLSClientHelloConn) Write

func (c *TLSClientHelloConn) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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