Skip to content

connect

connect handles plain HTTP CONNECT tunneling.

It owns:

  • hijacking the downstream connection
  • dialing the upstream target
  • sending 200 Connection Established
  • copying bytes in both directions
  • lifecycle hooks

It does not own MITM policy. MITM belongs in a separate optional layer.

Main entry point

go
handler := connect.New(connect.Options{})

Important options

OptionMeaning
DialContextCustom network dialer
ObserveRequestPredicate to suppress observation
HooksShared observation hooks
NetworkDial network, default tcp
WriteErrorCustom HTTP error writer before hijack

Protocol events

When a tunnel is established, connect can emit a neutral protocol event:

  • namespace: /_sys
  • name: tunnel_established

Your application can use that signal or ignore it.

Released under the Apache 2.0 License.