revdial
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
golang.org/x/build/revdial/v2
Package revdial implements a Dialer and Listener which work together to turn an accepted connection (for instance, a Hijacked HTTP request) into a Dialer which can then create net.Conns connecting back to the original dialer, which then gets a net.Listener accepting those conns.
Documentation¶
Overview¶
Package revdial implements a Dialer and Listener which work togetherto turn an accepted connection (for instance, a Hijacked HTTP request) intoa Dialer which can then create net.Conns connecting back to the originaldialer, which then gets a net.Listener accepting those conns.
This is basically a very minimal SOCKS5 client & server.
The motivation is that sometimes you want to run a server on amachine deep inside a NAT. Rather than connecting to the machinedirectly (which you can't, because of the NAT), you have thesequestered machine connect out to a public machine. Both sidesthen use revdial and the public machine can become a client for theNATed machine.
Index¶
Constants¶
This section is empty.
Variables¶
var ErrListenerClosed =errors.New("revdial: Listener closed")ErrListenerClosed is returned by Accept after Close has been called.
Functions¶
funcConnHandler¶
ConnHandler returns the HTTP handler that needs to be mounted somewherethat the Listeners can dial out and get to. A dialer to connect to itis given to NewListener and the path to reach it is given to NewDialerto use in messages to the listener.
funcReadProtoSwitchOrRedirect¶
ReadProtoSwitchOrRedirect is a helper for completing revdial protocol switchrequests. If the response indicates successful switch, nothing is returned.If the response indicates a redirect, the new location is returned.
Types¶
typeDialer¶
type Dialer struct {// contains filtered or unexported fields}The Dialer can create new connections.
funcNewDialer¶
NewDialer returns the side of the connection which will initiatenew connections. This will typically be the side which did the HTTPHijack. The connection is (typically) the hijacked HTTP clientconnection. The connPath is the HTTP path and optional query (butwithout scheme or host) on the dialer where the ConnHandler ismounted.
typeListener¶
type Listener struct {// contains filtered or unexported fields}Listener is a net.Listener, returning new connections which arrivefrom a corresponding Dialer.
funcNewListener¶
NewListener returns a new Listener, accepting connections whicharrive from the provided server connection, which should be afterany necessary authentication (usually after an HTTP exchange).
The provided dialServer func is responsible for connecting back tothe server and doing TLS setup.
func (*Listener)Addr¶
Addr returns a dummy address. This exists only to conform to thenet.Listener interface.