Documentation
¶
Overview ¶
Package netproxy runs a loopback HTTP proxy that all downloads are pointed at. Its only job is to be a place where the speed limit can be enforced: the embedded download engine offers no rate-limit hook, but it does let us set a proxy, so the bytes come past here on their way in.
It listens on 127.0.0.1 only and is never exposed.
It is the meter, and being the meter is the whole of it: this proxy chains into nothing. It dials the target itself, which is why a download that comes through here is both metered and unproxied - and why "the direct gateway" and "the loopback proxy" are the same path, not two.
The hazard that follows from that is worth stating where somebody reading this package will find it. Per-download routing works by naming a proxy on the download request itself, and gopeed resolves the request's proxy INSTEAD of the global one, not in addition to it. So a routed download does not come past here at all and is not metered. That is a deliberate trade in this build (see Engine.DownloadVia); the reason it is not fixed here is that carrying an upstream proxy per download would need this one listener to learn which download each connection belongs to, and a request carries nothing that says so. The arrangement that answers it is a listener per task, which is what the bandwidth budget is being built around - not a chain bolted onto this file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.