Help us shape the future of Go! Take the 2026 Go Developer Survey

httpproxy

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package httpproxy opens TCP tunnels through an HTTP proxy using CONNECT.

It sits in a neutral package because both callers need it and neither can hold it: ws cannot import host/internal, since host/internal imports server and server imports ws.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, proxyURL *url.URL, addr string) (net.Conn, error)

Dial opens a TCP tunnel to addr through the HTTP proxy at proxyURL. The context bounds the dial and the CONNECT exchange, not the lifetime of the returned connection: its deadline, and a cancel too.

func WebSocketServerURL

func WebSocketServerURL(host string) string

WebSocketServerURL formats host as a wss:// --server value.

Exported because the CONNECT refusal here and the dial-failure hint in host/internal both suggest one, and a bare IPv6 address needs bracketing to be a valid authority — "wss://2001:db8::1" is not a URL either of them could have accepted back.

func WithCause added in v0.35.0

func WithCause(ctx context.Context, closed bool, err error) error

WithCause wraps err in ctx's error when ctx is what failed a dial or a CONNECT exchange: closed says its close-on-cancel ran, and a socket timeout once ctx's deadline has passed is the deadline the socket copied from ctx. A failure ctx had no part in keeps its own error, so a cancel that merely coincides with it cannot hide it.

Types

This section is empty.

Directories

Path Synopsis
Package httpproxytest provides a stub HTTP CONNECT proxy for tests.
Package httpproxytest provides a stub HTTP CONNECT proxy for tests.

Jump to

Keyboard shortcuts

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