···22name = "allegedly"
33description = "public ledger server tools and services (for the PLC)"
44license = "MIT OR Apache-2.0"
55-version = "0.2.1"
55+version = "0.3.0"
66edition = "2024"
77default-run = "allegedly"
88
+11-6
readme.md
···2626 sudo allegedly mirror \
2727 --upstream "https://plc.directory" \
2828 --wrap "http://127.0.0.1:3000" \
2929+ --wrap-pg-cert "/opt/allegedly/postgres-cert.pem" \
2930 --acme-domain "plc.wtf" \
3131+ --acme-domain "alt.plc.wtf" \
3232+ --experimental-acme-domain "experimental.plc.wtf" \
3033 --acme-cache-path ./acme-cache \
3131- --acme-directory-url "https://acme-staging-v02.api.letsencrypt.org/directory"
3434+ --acme-directory-url "https://acme-staging-v02.api.letsencrypt.org/directory" \
3535+ --acme-ipv6 \
3636+ --experimental-write-upstream
3237 ```
33383439···68736974### new things
70757171-- experimental: websocket version of /export
7272-- experimental: accept writes by forwarding them upstream
7373-- experimental: serve a tlog
7474-- experimental: embed a log database directly for fast and efficient mirroring
7575-- experimental: support multiple upstreams?
7676+- [ ] experimental: websocket version of /export
7777+- [x] experimental: accept writes by forwarding them upstream
7878+- [ ] experimental: serve a tlog
7979+- [ ] experimental: embed a log database directly for fast and efficient mirroring
8080+- [ ] experimental: support multiple upstreams?
76817782- [ ] new command todo: `zip` or `check` or `diff`: compare two plc logs over some time range
7883- [ ] new command to consider: `scatter` or something: broadcast plc writes to multiple upstreams
+25-4
src/mirror.rs
···2525}
26262727#[handler]
2828-fn hello(Data(State { upstream, .. }): Data<&State>) -> String {
2828+fn hello(
2929+ Data(State {
3030+ upstream,
3131+ experimental: exp,
3232+ ..
3333+ }): Data<&State>,
3434+ req: &Request,
3535+) -> String {
3636+ let post_info = match (exp.write_upstream, &exp.acme_domain, req.uri().host()) {
3737+ (false, _, _) => " - POST /* Always rejected. This is a mirror.".to_string(),
3838+ (_, None, _) => {
3939+ " - POST /:did Create a PLC op. Allegedly will forward it upstream.".to_string()
4040+ }
4141+ (_, Some(d), Some(f)) if f == d => {
4242+ " - POST /:did Create a PLC op. Allegedly will forward it upstream.".to_string()
4343+ }
4444+ (_, Some(d), _) => format!(
4545+ r#"\
4646+ - POST /* Rejected, but experimental upstream op forwarding is
4747+ available at `POST {d}/:did`!"#
4848+ ),
4949+ };
5050+2951 format!(
3052 r#"{}
3153···4567 - GET /* Proxies to wrapped server; see PLC API docs:
4668 https://web.plc.directory/api/redoc
47694848- - POST /* Always rejected. This is a mirror.
7070+ tip: try `GET /{{did}}` to resolve an identity
49715050-5151- tip: try `GET /{{did}}` to resolve an identity
7272+{post_info}
527353745475Allegedly is a suite of open-source CLI tools from for working with PLC logs,