Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
2.4 KiB
agent-base
Turn a function into an http.Agent instance
This module is a thin wrapper around the base http.Agent class.
It provides an abstract class that must define a connect() function,
which is responsible for creating the underlying socket that the HTTP
client requests will use.
The connect() function may return an arbitrary Duplex stream, or
another http.Agent instance to delegate the request to, and may be
asynchronous (by defining an async function).
Instances of this agent can be used with the http and https
modules. To differentiate, the options parameter in the connect()
function includes a secureEndpoint property, which can be checked
to determine what type of socket should be returned.
Some subclasses:
Here are some more interesting uses of agent-base.
Send a pull request to list yours!
http-proxy-agent: An HTTP(s) proxyhttp.Agentimplementation for HTTP endpointshttps-proxy-agent: An HTTP(s) proxyhttp.Agentimplementation for HTTPS endpointspac-proxy-agent: A PAC file proxyhttp.Agentimplementation for HTTP and HTTPSsocks-proxy-agent: A SOCKS proxyhttp.Agentimplementation for HTTP and HTTPS
Example
Here's a minimal example that creates a new net.Socket or tls.Socket
based on the secureEndpoint property. This agent can be used with both
the http and https modules.
import * as net from 'net';
import * as tls from 'tls';
import * as http from 'http';
import { Agent } from 'agent-base';
class MyAgent extends Agent {
connect(req, opts) {
// `secureEndpoint` is true when using the "https" module
if (opts.secureEndpoint) {
return tls.connect(opts);
} else {
return net.connect(opts);
}
}
});
// Keep alive enabled means that `connect()` will only be
// invoked when a new connection needs to be created
const agent = new MyAgent({ keepAlive: true });
// Pass the `agent` option when creating the HTTP request
http.get('http://nodejs.org/api/', { agent }, (res) => {
console.log('"response" event!', res.headers);
res.pipe(process.stdout);
});