http

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHttp2

func IsHttp2(b []byte) bool

func ParseHost

func ParseHost(rawHost string, defaultPort net.Port) (net.Destination, error)

ParseHost splits host and port from a raw string. Default port is used when raw string doesn't contain port.

func ParseXForwardedFor

func ParseXForwardedFor(header http.Header) []net.Address

ParseXForwardedFor parses X-Forwarded-For header in http headers, and return the IP list in it.

func RemoveHopByHopHeaders

func RemoveHopByHopHeaders(header http.Header)

RemoveHopByHopHeaders remove hop by hop headers in http header list.

Types

type Http1Header

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

func SniffHttp1

func SniffHttp1(b []byte) (*Http1Header, error)

if whether b is http1 cannot be determined, return nil, protocol.ErrNoClue if b is not http1, return nil, errNotHttp1 if b is http1, returns a Http1Header

func (*Http1Header) FullPath

func (h *Http1Header) FullPath() string

FullPath returns the complete path including query string

func (*Http1Header) Host

func (h *Http1Header) Host() string

func (*Http1Header) Method

func (h *Http1Header) Method() string

Method returns the HTTP method (GET, POST, etc.)

func (*Http1Header) Path

func (h *Http1Header) Path() string

Path returns the request path

func (*Http1Header) Query

func (h *Http1Header) Query() string

Query returns the query string

func (*Http1Header) Version

func (h *Http1Header) Version() string

Version returns the HTTP version (e.g., "HTTP/1.1", "HTTP/1.0", "HTTP/2.0")

type SniffHeader

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

func SniffHTTP1Host

func SniffHTTP1Host(b []byte) (*SniffHeader, error)

func (*SniffHeader) Domain

func (h *SniffHeader) Domain() string

func (*SniffHeader) Protocol

func (h *SniffHeader) Protocol() string

Jump to

Keyboard shortcuts

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