package module
v0.0.0-...-c35c9d2 Latest Latest

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 5 Imported by: 0



Parser of HTTP Forward Header




This section is empty.


This section is empty.


func Encode

func Encode(f []*Forwarded) string

Encode encodes the Forwarded header.


type Error

type Error struct {
	Message string
	Index   int
	Pos     int

Error represents an error that occurred while parsing the Forwarded header.

func (*Error) Error

func (e *Error) Error() string

type Forwarded

type Forwarded struct {
	// By is used to disclose the interface where the request came in to the proxy server.
	By Node

	// For is used to disclose information about the client that initiated the request and subsequent proxies in a chain of proxies.
	For Node

	// Host is used to forward the original value of the "Host" header field.
	Host string

	// Proto is the value of the used protocol type.
	Proto string

Forwarded represents the Forwarded header.

func Parse

func Parse(h []string) ([]*Forwarded, error)

Parse parses the Forwarded header.

func (*Forwarded) String

func (f *Forwarded) String() string

String returns the string representation of the Forwarded header. The returned string is a valid Forwarded header.

type Node

type Node struct {
	IP             netip.Addr
	Port           int
	ObfuscatedNode string
	ObfuscatedPort string

A Node represents a node identifier in a Forwarded header

func (Node) String

func (n Node) String() string

Jump to

Keyboard shortcuts

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