httptrans

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectEstablished = "HTTP/1.1 200 Connection established\n\n"
View Source
const RegExpMethods = http.MethodConnect + "|" +
	http.MethodGet + "|" +
	http.MethodHead + "|" +
	http.MethodPost + "|" +
	http.MethodPut + "|" +
	http.MethodPatch + "|" +
	http.MethodDelete + "|" +
	http.MethodOptions + "|" +
	http.MethodTrace

Variables

This section is empty.

Functions

func TransferFromListen

func TransferFromListen(lAddr *net.TCPAddr, keepListening bool, output *HttpTransferContext) error

func TransferFromListenAddress

func TransferFromListenAddress(lAddress string, keepListening bool, output *HttpTransferContext) error

func TransferHTTP

func TransferHTTP(src net.Conn, closed bool) (chan iokit.Direction, error)

func TransferTCPOrHTTP

func TransferTCPOrHTTP(src net.Conn, dst net.Conn, closed bool) (chan iokit.Direction, error)

func TransferTCPOrHTTPDynamic

func TransferTCPOrHTTPDynamic(src net.Conn, dstConnFactory iokit.ConnFactoryFunc, closed bool) (chan iokit.Direction, error)

Types

type HttpPacket

type HttpPacket struct {
	Data     []byte
	Protocol string
	Method   string
	Host     string
	Port     int
}

func ResolvePacket

func ResolvePacket(readLine []byte) (*HttpPacket, error)

func (HttpPacket) DialDSTConn

func (p HttpPacket) DialDSTConn() (net.Conn, error)

func (HttpPacket) GetAddress

func (p HttpPacket) GetAddress() string

func (HttpPacket) IsMethodConnect

func (p HttpPacket) IsMethodConnect() bool

type HttpTransferContext

type HttpTransferContext struct {
	LAddr         *net.TCPAddr
	DAddr         *net.TCPAddr
	KeepListening bool
	LListener     *net.TCPListener
	DListener     *net.TCPListener
	StopChan      *chan os.Signal
}

func BuildTransfer

func BuildTransfer(lAddress string, keepListening bool) (*HttpTransferContext, error)

func (HttpTransferContext) GetDListener

func (t HttpTransferContext) GetDListener() *net.TCPListener

func (HttpTransferContext) GetLListener

func (t HttpTransferContext) GetLListener() *net.TCPListener

func (HttpTransferContext) Stop

func (t HttpTransferContext) Stop()

func (HttpTransferContext) TransferFromListen

func (t HttpTransferContext) TransferFromListen() error

type ParsePacketToConnFunc

type ParsePacketToConnFunc func(*HttpPacket) (net.Conn, error)

Jump to

Keyboard shortcuts

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