Skip to content

net/http: Hijacker for original/redirect IP addresses when using IP_TRANSPARENT or NAT/NAPT #18734

@elico

Description

@elico

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.6+1.7

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/eliezer/go-workspace"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build576063994=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I use http connection hijack and it locks the connection completly.
https://golang.org/src/net/http/server.go?h=hijacked#L254

What did you expect to see?

An option to hijack the connection so I would be able to extrct from it the local address(for a transparent proxy)
Like I can be done on a regular connection at:
https://github.com/elico/go-linux-tproxy/blob/master/examples/tcpproxy1.go#L167
And I am sure a method that can be a way to do so without any issues.
I was thikning aobut supplying a special listener with a middleware that will pass the local address into the request as an header But would be happy to see one(maybe there is and I don't know about).

What did you see instead?

The only option is to hijack the connection and then manage it.
This is while I don't touch any read or write methods on the connections,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions