netproxy

package
v0.1.409 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package netproxy decides which proxy magpie's own requests to vendors go through. An app started from the Dock or the Start menu has no HTTPS_PROXY in its environment, so without this every call to a vendor that is only reachable through a proxy hangs until the agent gives up.

In order: the proxy set in magpie's settings (or "direct" for none), the usual *_PROXY variables, then the system's proxy (macOS network settings, Windows Internet Options). Loopback is never proxied.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Describe

func Describe() (proxy, source string)

Describe says, for the settings page, what a request to u would use.

func Env added in v0.1.53

func Env(env []string) []string

Env is env (the process's own when nil) for an agent's CLI that magpie starts — a sign-in, or a subscription's run — told to use the proxy magpie's own requests would: the CLI reads only *_PROXY, which an app started from the Dock or the Start menu doesn't have, so a proxy set in magpie or the system's alone left it trying the vendor directly. A proxy set in magpie replaces any in env and "direct" drops them; the system's is only added where env names none. Loopback never goes through it, since a CLI calls back to magpie there.

func For

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

For is the proxy a request to u goes through; nil means direct.

func Func

func Func(req *http.Request) (*url.URL, error)

Func is an http.Transport Proxy function.

func Install

func Install()

Install routes http.DefaultTransport (and so http.DefaultClient) through Func.

func Parse

func Parse(s string) (*url.URL, error)

Parse reads a proxy address; a bare host:port is an HTTP proxy.

Types

type Proxy

type Proxy struct {
	URL    string
	Bypass []string
}

Proxy is the system's proxy: one address, and the hosts that skip it.

func System

func System() Proxy

System reads the system proxy, at most every 15 seconds.

Jump to

Keyboard shortcuts

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