Documentation
¶
Overview ¶
Package hack includes wraps and hacks of Go net stack.
Index ¶
- Variables
- type ChannelListener
- type HTTP1HeaderConn
- type HTTP1HeaderListener
- type HijackClientHelloConn
- func (c *HijackClientHelloConn) Close() error
- func (c *HijackClientHelloConn) GetClientHello() ([]byte, error)
- func (c *HijackClientHelloConn) LocalAddr() net.Addr
- func (c *HijackClientHelloConn) Read(b []byte) (int, error)
- func (c *HijackClientHelloConn) RemoteAddr() net.Addr
- func (c *HijackClientHelloConn) SetDeadline(t time.Time) error
- func (c *HijackClientHelloConn) SetReadDeadline(t time.Time) error
- func (c *HijackClientHelloConn) SetWriteDeadline(t time.Time) error
- func (c *HijackClientHelloConn) Write(b []byte) (n int, err error)
- type TLSClientHelloConn
- func (c *TLSClientHelloConn) Close() error
- func (c *TLSClientHelloConn) LocalAddr() net.Addr
- func (c *TLSClientHelloConn) Read(b []byte) (n int, err error)
- func (c *TLSClientHelloConn) RemoteAddr() net.Addr
- func (c *TLSClientHelloConn) SetDeadline(t time.Time) error
- func (c *TLSClientHelloConn) SetReadDeadline(t time.Time) error
- func (c *TLSClientHelloConn) SetWriteDeadline(t time.Time) error
- func (c *TLSClientHelloConn) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
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) 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 ¶
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
type HTTP1HeaderListener ¶
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) 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
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) 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