Documentation
¶
Overview ¶
Command dexafix is the entry point of the binary. It sets up logging and runs the command line implemented in package cmd.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmd implements the DexaFix command line: `serve` runs the web app, `db` migrates and copies the database, and `info` prints information about the binary.
|
Package cmd implements the DexaFix command line: `serve` runs the web app, `db` migrates and copies the database, and `info` prints information about the binary. |
|
pkg
|
|
|
app
Package app runs the application as one process: a frontend and a backend that talk to each other through the internal API over an in-process transport, exactly as two processes would over the network.
|
Package app runs the application as one process: a frontend and a backend that talk to each other through the internal API over an in-process transport, exactly as two processes would over the network. |
|
backend/body
Package bodybackend is the body service: a user's scale readings and DEXA scans, the estimates computed from them and the rules for importing readings from a source such as Withings.
|
Package bodybackend is the body service: a user's scale readings and DEXA scans, the estimates computed from them and the rules for importing readings from a source such as Withings. |
|
backend/main
Package mainbackend is the main backend, the process behind `dexafix serve api`.
|
Package mainbackend is the main backend, the process behind `dexafix serve api`. |
|
estimate
Package estimate builds one estimated result per day from DEXA scans and scale/body-composition readings.
|
Package estimate builds one estimated result per day from DEXA scans and scale/body-composition readings. |
|
frontend
Package frontend serves the HTML pages (Go templates + htmx).
|
Package frontend serves the HTML pages (Go templates + htmx). |
|
mailer
Package mailer sends plain-text e-mail through an SMTP server.
|
Package mailer sends plain-text e-mail through an SMTP server. |
|
models
Package models holds the domain types shared by the store, estimator and web layers.
|
Package models holds the domain types shared by the store, estimator and web layers. |
|
shared
Package shared is the parent of the packages that the frontend and the backend have in common.
|
Package shared is the parent of the packages that the frontend and the backend have in common. |
|
shared/apiclient
Package apiclient is how the frontend process talks to the backend process.
|
Package apiclient is how the frontend process talks to the backend process. |
|
shared/bodyapi
Package bodyapi is the contract between the main backend and the body service, the part that holds a user's scale readings and DEXA scans and computes their estimates.
|
Package bodyapi is the contract between the main backend and the body service, the part that holds a user's scale readings and DEXA scans and computes their estimates. |
|
shared/edge
Package edge holds the HTTP edge code shared by the frontend and the backend process: working out who the visitor is behind a reverse proxy, the PROXY protocol, and request limiting.
|
Package edge holds the HTTP edge code shared by the frontend and the backend process: working out who the visitor is behind a reverse proxy, the PROXY protocol, and request limiting. |
|
shared/inproc
Package inproc is an http.RoundTripper that runs a request against an http.Handler in the same process.
|
Package inproc is an http.RoundTripper that runs a request against an http.Handler in the same process. |
|
shared/jobs
Package jobs tracks the background jobs of one half of the application.
|
Package jobs tracks the background jobs of one half of the application. |
|
shared/mtls
Package mtls secures the link between the web (frontend) and api (backend) processes with mutual TLS: the backend only talks to a client that presents a certificate from the configured CA, and the frontend only talks to a backend that presents one.
|
Package mtls secures the link between the web (frontend) and api (backend) processes with mutual TLS: the backend only talks to a client that presents a certificate from the configured CA, and the frontend only talks to a backend that presents one. |
|
shared/must
Package must turns an error that cannot happen into a panic, so that a caller does not carry a branch no test can reach.
|
Package must turns an error that cannot happen into a panic, so that a caller does not carry a branch no test can reach. |
|
shared/netguard
Package netguard keeps the backend's own outgoing connections (to an administrator's sign-in providers and mail server) away from addresses that a typo or a hostile setting must not be able to reach: the cloud metadata services and the other addresses on a link, and, unless an administrator allows it, the private networks the server sits in.
|
Package netguard keeps the backend's own outgoing connections (to an administrator's sign-in providers and mail server) away from addresses that a typo or a hostile setting must not be able to reach: the cloud metadata services and the other addresses on a link, and, unless an administrator allows it, the private networks the server sits in. |
|
shared/timezones
Package timezones lists the common IANA time zones and validates a name.
|
Package timezones lists the common IANA time zones and validates a name. |
|
shared/tlsutil
Package tlsutil checks PEM certificates; the frontend serves them and the backend stores them.
|
Package tlsutil checks PEM certificates; the frontend serves them and the backend stores them. |
|
shared/workerapi
Package workerapi is the contract between the backend and the workers: processes that talk to outside services (Withings, Strength Level, ...) for the backend and have no database.
|
Package workerapi is the contract between the backend and the workers: processes that talk to outside services (Withings, Strength Level, ...) for the backend and have no database. |
|
store
Package store defines the persistence interface used by the application.
|
Package store defines the persistence interface used by the application. |
|
store/sqlstore
Package sqlstore implements store.Store on top of bun, for SQLite and PostgreSQL.
|
Package sqlstore implements store.Store on top of bun, for SQLite and PostgreSQL. |
|
store/valkeystate
Package valkeystate keeps the state that must agree across backend processes and is touched on every sign-in in Valkey (or any Redis-compatible server) instead of the database: the failed attempt counters and the single-use nonces.
|
Package valkeystate keeps the state that must agree across backend processes and is touched on every sign-in in Valkey (or any Redis-compatible server) instead of the database: the failed attempt counters and the single-use nonces. |
|
workers
Package workers is the parent folder of the worker processes' code: one package per provider (pkg/workers/withings, pkg/workers/strengthlevel, ...) next to the generic loop in pkg/workers/runner.
|
Package workers is the parent folder of the worker processes' code: one package per provider (pkg/workers/withings, pkg/workers/strengthlevel, ...) next to the generic loop in pkg/workers/runner. |
|
workers/builtin
Package builtin lists the workers that ship with the program, so the processes that run them (dexafix serve worker, and the single-process mode) choose providers by name without knowing any of them.
|
Package builtin lists the workers that ship with the program, so the processes that run them (dexafix serve worker, and the single-process mode) choose providers by name without knowing any of them. |
|
workers/runner
Package runner is the loop every worker runs: register with the backend, lease jobs, run the handler of the job's kind while renewing the lease, and report how it ended.
|
Package runner is the loop every worker runs: register with the backend, lease jobs, run the handler of the job's kind while renewing the lease, and report how it ended. |
|
workers/strengthlevel
Package strengthlevel is the worker for Strength Level.
|
Package strengthlevel is the worker for Strength Level. |
|
workers/withings
Package withings is the worker for Withings: it talks to the Withings API for the backend.
|
Package withings is the worker for Withings: it talks to the Withings API for the backend. |
Click to show internal directories.
Click to hide internal directories.