sysproxy

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sysproxy finds the HTTP proxy a connection has to go through, for the one thing RemoHop sends over HTTP: the websocket bridge to the rendezvous server (internal/wsdgram), which is the way out of a network that allows nothing else.

In the order they are asked:

  • the environment: HTTPS_PROXY, HTTP_PROXY and NO_PROXY, in either case, as every command-line tool reads them. If any of them is set, the environment decides, including "no proxy";
  • the `proxy` setting: a proxy URL, or off. It is for machines whose programs are not started from a shell (the desktop app, a service), and for the proxy's user and password where it wants them;
  • the system's own settings, where the people who run an office network put the proxy: on Windows the Internet Options of the current user, on macOS the network service's proxies.

A proxy auto-config script (PAC) in the system's settings is reported, not evaluated: Describe names it, so that doctor can say that the proxy it would pick has to be set by hand.

Index

Constants

View Source
const (
	FromEnvironment = "environment"
	FromSetting     = "setting"
	FromSystem      = "system"
)

Where a proxy comes from (Info.Source).

View Source
const SettingProxy = "proxy"

SettingProxy is the config key of the proxy setting.

Variables

This section is empty.

Functions

func ForURL

func ForURL(u *url.URL) (*url.URL, error)

ForURL returns the proxy to reach u through, or nil for none.

Types

type Info

type Info struct {
	// Proxy is the proxy, without credentials; empty for a direct
	// connection. HasCredentials says a user name came with it.
	Proxy          string
	HasCredentials bool
	// Source is where the answer comes from: FromEnvironment, FromSetting
	// or FromSystem.
	Source string
	// PAC is the system's proxy auto-config script and AutoDetect its
	// "detect settings automatically", when the system's settings were
	// what was asked and they name no proxy for u: the script might, and
	// it is not evaluated.
	PAC        string
	AutoDetect bool
	// Error is why the proxy could not be determined.
	Error string
}

Info describes how u would be reached, for diagnosis.

func Describe

func Describe(u *url.URL) Info

Describe reports how u would be reached.

func (Info) String

func (in Info) String() string

String is Info in a line.

type System

type System struct {
	// HTTPS is the proxy for HTTPS requests, HOST:PORT or a URL; empty
	// for none.
	HTTPS string
	// Bypass lists hosts that are reached directly: names, patterns with
	// * (*.corp.example), and <local> for names without a dot.
	Bypass []string
	// PAC is the URL of a proxy auto-config script, AutoDetect whether
	// the system is set to look for one (WPAD). Neither is followed.
	PAC        string
	AutoDetect bool
}

System is what the operating system's proxy settings say.

Jump to

Keyboard shortcuts

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