letify 2.11.0__tar.gz → 2.11.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {letify-2.11.0 → letify-2.11.2}/PKG-INFO +1 -1
- {letify-2.11.0 → letify-2.11.2}/docs/ROADMAP-3.0.md +1 -1
- {letify-2.11.0 → letify-2.11.2}/docs/SPEC.md +5 -2
- {letify-2.11.0 → letify-2.11.2}/docs/guide/09-agent.md +1 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/09-/354/227/220/354/235/264/354/240/204/355/212/270.md +1 -0
- {letify-2.11.0 → letify-2.11.2}/letify/__init__.py +1 -1
- letify-2.11.2/letify/providers/tunnel.py +135 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkchannel.py +59 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linksignal.py +115 -10
- {letify-2.11.0 → letify-2.11.2}/letify-core/Cargo.lock +3 -3
- {letify-2.11.0 → letify-2.11.2}/letify-core/Cargo.toml +1 -1
- {letify-2.11.0 → letify-2.11.2}/letify-ext/package-lock.json +2 -2
- {letify-2.11.0 → letify-2.11.2}/letify-ext/package.json +1 -1
- {letify-2.11.0 → letify-2.11.2}/pyproject.toml +1 -1
- {letify-2.11.0 → letify-2.11.2}/tests/conftest.py +28 -2
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_agent.py +58 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_signal.py +66 -0
- letify-2.11.0/letify/providers/tunnel.py +0 -27
- {letify-2.11.0 → letify-2.11.2}/.github/workflows/ci.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/.github/workflows/docs.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/.github/workflows/letify-link.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/.github/workflows/publish-crates.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/.github/workflows/publish.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/.github/workflows/reserve-crates.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/.gitignore +0 -0
- {letify-2.11.0 → letify-2.11.2}/.researchtree +0 -0
- {letify-2.11.0 → letify-2.11.2}/CLAUDE.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/LICENSE +0 -0
- {letify-2.11.0 → letify-2.11.2}/PROJECT.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/COMPONENT.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/INTENT.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/NETWORK.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/01-getting-started.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/02-providers.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/03-execution-modes.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/04-environments-and-data.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/05-concurrency.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/06-cost.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/07-troubleshooting.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/08-releasing.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/01-/354/213/234/354/236/221/355/225/230/352/270/260.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/02-/355/224/204/353/241/234/353/260/224/354/235/264/353/215/224.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/03-/354/213/244/355/226/211-/353/260/251/354/213/235.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/04-/355/231/230/352/262/275/352/263/274-/353/215/260/354/235/264/355/204/260.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/05-/353/217/231/354/213/234-/354/213/244/355/226/211.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/06-/353/271/204/354/232/251.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/07-/353/254/270/354/240/234-/355/225/264/352/262/260.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/08-/353/246/264/353/246/254/354/212/244.md" +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/guide/ko/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/locales/README_ko.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/docs/mkdocs.yml +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/.letify.example +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/00_smoke.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/01_sweep.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/02_resume.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/03_watch.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/README_ko.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/common.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/examples/nvfp4-lora/recipe.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/cli.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/config/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/config/inventory.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/config/login.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/config/schema.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/config/secrets.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/config/writer.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/cache.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/env.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/exit.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/function.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/instance.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/reduce.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/declare/replicas.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/errors.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/install.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/launcher.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/paths.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/protocol/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/protocol/codec.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/protocol/driver.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/protocol/handle.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/protocol/wire.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/protocol/worker.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/base.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/colab.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/colab_files.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/colab_keepalive.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/elice.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/kaggle.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/kaggle_adapter.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/local.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/modal.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/modal_adapter.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/naming.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/shell.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/providers/usage.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/client.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/cuda.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/executor.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/frames.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/guard.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/tensor.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/trace.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/remoting/device/value.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/render.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/bootstrap.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/broker.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/channel.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/control.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/lease.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/pool.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/reattach.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/session.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/takeover.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/telemetry.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/runtime/workers.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/backends/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/backends/drive.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/backends/filesystem.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/backends/google_auth.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/backends/layout.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/backends/objects.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/cas.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/handoff.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/pathdata.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/sendorder.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/store/volume.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/stubs.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/tools.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/__init__.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/agent.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/announce.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/link.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkagent.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkd.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkmailbox.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkpump.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkshim.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkupload.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/linkwebsocket.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/nat.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/pipeline.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/portmap.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/probe.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/quic.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/rendezvous.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/setup.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/sshopts.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify/transport/strategies.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/.gitignore +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/build.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify/Cargo.toml +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify/LICENSE +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify/src/lib.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/Cargo.toml +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/examples/bench.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/acceptor.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/bin/letify-link.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/config.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/error.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/frame.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/handshake.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/hysteresis.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/identity.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/keys.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/lib.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/observe.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/paths.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/plan.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/policing.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/punch.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/record.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/relay.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/rendezvous.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/replay.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/session.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/sidecar.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/stream.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/stun.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/tcp.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/trace.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/src/udp.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/acceptor.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/api.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/common/mod.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/diag_sim.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/fairness.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/gauge.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/handshake.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/hysteresis.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/keepalive.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/mobile.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/nat.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/paths.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/qad.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/rekey.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/relay.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/relay_pairing.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/rendezvous.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/reorder.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/replay.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/resume.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/revoke.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/session.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/sidecar.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/startup.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/subflows.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/trace.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/udp.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-link/tests/udp_bench.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-quic/Cargo.toml +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/letify-quic/src/main.rs +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-core/rust-toolchain.toml +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/.vscodeignore +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/LICENSE +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/media/icon.svg +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/src/cli.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/src/extension.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/src/history.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/src/model.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/src/poll.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/src/render.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/test/cli.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/test/manifest.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/test/model.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/test/regressions.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-ext/tsconfig.json +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/README.md +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/cloudflare.config.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/package-lock.json +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/package.json +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/auth.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/ed25519.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/handler.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/index.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/limiter.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/mailbox.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/objects.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/protocol.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/src/storage.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/auth.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/ed25519.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/helpers.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/interop.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/limiter.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/mailbox.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/objects.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/setup.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/test/worker.test.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/tsconfig.json +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify-signal/vitest.config.ts +0 -0
- {letify-2.11.0 → letify-2.11.2}/letify_providers.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/scripts/sync-main.sh +0 -0
- {letify-2.11.0 → letify-2.11.2}/scripts/version.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/fake_kaggle_adapter.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/fake_modal_adapter.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_cli.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_cli_output.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_colab_keepalive.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_config.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_core.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_data.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_data_in_place.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_data_streaming.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_declare.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_device.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_device_compile.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_distributed.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_drive_handoff.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_drive_store.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_editor_sessions.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_elice.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_frames.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_install.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_kaggle.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_kaggle_cookie.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_kaggle_link.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_channel.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_command_channel.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_exec.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_log.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_opt_in.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_link_upload.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_linkd.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_notebook.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_parallel_placement.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_paths.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_portmap.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_protocol.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_providers.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_punch_sockets.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_quic.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_remoting.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_render.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_run_control.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_run_reattach.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_run_takeover.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_runtime.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_shell_workers.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_ship.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_store.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_strategies.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_stubs.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_transport.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_tunnel_setup.py +0 -0
- {letify-2.11.0 → letify-2.11.2}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: letify
|
|
3
|
-
Version: 2.11.
|
|
3
|
+
Version: 2.11.2
|
|
4
4
|
Summary: Declarations that become infrastructure.
|
|
5
5
|
Project-URL: Homepage, https://github.com/DarkPyonix/letify
|
|
6
6
|
Project-URL: Documentation, https://github.com/DarkPyonix/letify/tree/main/docs
|
|
@@ -18,7 +18,7 @@ This file is planning. The design is in [SPEC.md, letify-link](SPEC.md#letify-li
|
|
|
18
18
|
|---|---|---|
|
|
19
19
|
| M1 | Multi-socket TCP punch with spare sockets | Done in 2.10.0 |
|
|
20
20
|
| M2 | Session layer and path manager, with the hysteresis of the path manager and the head-of-line blocking measurement of many streams over TCP subflows against QUIC streams | Built on `feat/letify-link-spec`: the encrypted multiplexed session, TCP and UDP subflows and the path manager are in the `letify-link` crate. The head-of-line measurement is open |
|
|
21
|
-
| M3 | NAT type detection, port spraying, policing detection, Tailcat replacement | Built on the branch: NAT classification, the punch, the signalling client and the Cloudflare Worker in `letify-signal/`, and the agent with pairing. Measured only against fakes
|
|
21
|
+
| M3 | NAT type detection, port spraying, policing detection, Tailcat replacement | Built on the branch: NAT classification, the punch, the signalling client and the Cloudflare Worker in `letify-signal/`, and the agent with pairing. Measured only against fakes until `feat/link-signal-live`, which connects a tunnel account to a paired agent through the signalling service alone and measures it live on Kaggle and Colab (all paths were TCP punches, 4 of 4 in every run). Remaining: the tunnel over letify-link (B4), UDP punch to a cloud VM, signalling round trip (2 to 6 s, mostly TLS setup per request). Tailcat is untouched |
|
|
22
22
|
| M4 | The `letify-link` crate and sidecar wired into letify | Built on the branch as opt-in: the sidecar, the shell, Colab and Kaggle bootstrap, transfer streams, takeover and helper commands over the session. Ships in 2.11 behind `link = "letify-link"`. Default and Tailcat removal are 3.0 |
|
|
23
23
|
|
|
24
24
|
Each milestone is judged by its own experiment pull request. A spec change that the verdict rejects does not reach `develop`.
|
|
@@ -2251,6 +2251,8 @@ The service is the auxiliary rendezvous of [Rendezvous trait](#link-rendezvous).
|
|
|
2251
2251
|
|
|
2252
2252
|
**User-Agent.** Every request, the WebSocket handshake included, carries `User-Agent: letify/<version>`, because Cloudflare's Browser Integrity Check answers the Python default `Python-urllib/<version>` with 403 and error code 1010 before the request reaches the Worker.
|
|
2253
2253
|
|
|
2254
|
+
**Connections.** `SignalClient` keeps the HTTPS connections it opened and sends the next request on an idle one, so a connect pays the TCP and TLS set-up once and not once per request. A connection serves one request at a time: a long poll holds its connection until it returns, so a send made meanwhile takes another idle connection or opens one, and at most 4 idle connections are kept (`MAX_IDLE`). A connection is returned to the idle list only after its reply was read to the end and the service did not say `Connection: close`. A request that fails on a reused connection before any reply byte arrives (the service or a middlebox closed it while idle) is sent once more on a new connection, signed again with a new nonce, and a failure on a new connection is not retried. The client uses `http.client` from the standard library. When the environment names a proxy for the service's host, it sends through `urllib` with a new connection per request, because `http.client` does not use a proxy. The WebSocket of `/ws/<node>` is its own connection and is not part of this list. The error texts do not change.
|
|
2255
|
+
|
|
2254
2256
|
2. **Signed requests.** Every request except `/health` carries four headers: `X-Letify-Node` (the signer, 64 lowercase hex), `X-Letify-Time` (unix seconds, decimal), `X-Letify-Nonce` (32 lowercase hex, 16 random bytes) and `X-Letify-Signature` (128 lowercase hex). The signature is ed25519 by the signer's node key over these bytes, the sidecar's `sign` with domain `letify-signal v1`:
|
|
2255
2257
|
|
|
2256
2258
|
```
|
|
@@ -2283,7 +2285,7 @@ The service is the auxiliary rendezvous of [Rendezvous trait](#link-rendezvous).
|
|
|
2283
2285
|
|
|
2284
2286
|
> A persistent agent reached through the signalling service serves the nodes paired with it, so an address-less machine needs no ssh server and no Tailcat.
|
|
2285
2287
|
|
|
2286
|
-
Hypothesis: one long-running process holding a list of paired node ids replaces the Tailcat agent of `letify client shell connect` for a machine with no address. The experiment is the branch `feat/link-agent-pairing`.
|
|
2288
|
+
Hypothesis: one long-running process holding a list of paired node ids replaces the Tailcat agent of `letify client shell connect` for a machine with no address. The experiment is the branch `feat/link-agent-pairing`. An account that names an agent is written by the login of item 8, and the connect that uses it is item 11. The experiment of item 11 is the branch `feat/link-signal-live`.
|
|
2287
2289
|
|
|
2288
2290
|
1. **Identity and state.** The agent keeps its state in `~/.letify/agent/` (under `LETIFY_HOME` when that is set), created with mode 0700. `link.key` is the agent's node key, the 64 hex character file of the sidecar, created by the sidecar with mode 0600 on first run and refused when group or others can read it, as [Relay](#link-relay) item 14 says. `paired.json` is `{"nodes":{"<node id>":{"label":"<text>","at":<unix s>}}}`, written by a temporary file and a rename with mode 0600. The label is at most 64 printable characters. The agent re-reads the file when its modification time changes, so `letify agent unpair` takes effect in a running agent within one poll, at the latest 5 s later (`POLL_S`, the wait of one poll).
|
|
2289
2291
|
2. **Token v2.** `letify agent serve` prints one line to give to the user side: the prefix `letify-agent2:` followed by URL-safe base64, without padding, of this JSON: `{"v":2,"agent":"<agent node id>","secret":"<64 hex, 32 random bytes>","signal":"<URL>","version":"<letify version>","exp":<unix s>}`. A token that does not start with the prefix is refused by name: when it decodes as a Tailcat token the error says it is a Tailcat token from `letify client shell connect` and that this login needs the one `letify agent serve` prints. The secret lives in the memory of the running agent only, so a restart invalidates every token it printed. The secret expires 15 minutes after it was made (`exp`) and works once. After 5 wrong proofs it is discarded. Each run prints a new token, and the paired list outlives the run.
|
|
@@ -2295,6 +2297,7 @@ Hypothesis: one long-running process holding a list of paired node ids replaces
|
|
|
2295
2297
|
8. **Login.** `letify login tunnel <alias> --connect <token>` dispatches on the prefix of the token: `letify-agent2:` takes this path, anything else takes the Tailcat path. This path needs no ssh and no Tailcat. It makes the account's node key `~/.letify/accounts/<alias>/link.key` (the key `connect_over` uses for the same account), pairs as item 3 says and writes `kind = "tunnel"`, `agent = "<agent node id>"` and `signal = "<URL>"`. A token past its `exp` is refused before anything is sent.
|
|
2296
2298
|
9. **Commands.** `letify agent` runs on the address-less machine and builds no Launcher, like `letify client`. It is a command of its own and not a flag of `letify client shell connect`, because that command is the Tailcat agent with an ssh server and the next branch removes it.
|
|
2297
2299
|
10. **Dependencies.** The agent is the standard library and the `letify-link` binary. It adds no package.
|
|
2300
|
+
11. **Connect.** A `tunnel` account with an `agent` field is reached through the agent, with no ssh and no Tailcat. The account is a letify-link account without a `link` option: `link = "ssh"` on it is refused by name, because there is no ssh server to reach. It has no address, so `Tunnel.address` is `None` and no strategy is raced. `Tunnel.link()` returns the session's measurements with no ssh command, as `Colab.link()` does. `connect_link` calls `linkchannel.connect_signal`, which opens the sidecar of the account's `link.key`, builds a `SignalClient` for the account's `signal` URL and a `SignalBootstrap` for the node `agent`, and calls `connect_over` with no address, `punch=True`, the channel named `the signalling service` and no binary preparation, because the agent holds the binary of its own machine. The ping of `SignalBootstrap.start` is the bootstrap round trip, so `lead_ms` and the shim wait follow the rules of [Sidecar interface](#link-sidecar) item 8. A failure raises `ProviderUnavailable` with the reason and falls back to nothing.
|
|
2298
2301
|
|
|
2299
2302
|
#### NAT traversal <!-- id: link-nat -->
|
|
2300
2303
|
|
|
@@ -2456,7 +2459,7 @@ The sidecar is a binary named `letify-link`, built for each wheel and installed
|
|
|
2456
2459
|
- **The worker command.** The shim starts each stream's worker and relay with the interpreter the account names. The provider's `remote_command` wrapper applies to them as it does to the ssh command of a worker: the local side passes the shim the complete shell command for a worker (`worker_command`) and the prefix of one for a relay (`relay_command`, to which the shim appends the quoted door path), each already wrapped by `remote_command`. Colab's wrapper sets `LD_LIBRARY_PATH` to the driver library directory, so a worker reached through the mailbox sees the GPU. Kaggle's wrapper sets `LD_LIBRARY_PATH` to the value the kernel reports, as it does for a worker over ssh. With neither key the shim runs the interpreter directly, as item 7 says.
|
|
2457
2460
|
- **No fallback.** A failed connect raises `ProviderUnavailable` with the reason. A Colab account that sets both `channel = "exec"` and `link = "letify-link"` is refused by name, because the two ask for different channels. A Kaggle account that sets `link = "letify-link"` does not fall back to the kernel bridge as an account without it does, because the account asked for the session.
|
|
2458
2461
|
- **After the hand-over.** The mailbox ends once the shim says `handed_over`. The command channel keeps serving what it served before (a Colab keep-alive, a Kaggle kernel bridge), and `Colab.link()` and `Kaggle.link()` return the session's measurements with no ssh command: asking such a link for an ssh command raises `RuntimeFailure`.
|
|
2459
|
-
9. **Bootstrap over the signalling service.** `letify/transport/linksignal.py` carries the `Bootstrap` of item 7 over the mailbox of [Signalling service](#link-signal). It uses the sidecar's `sign` and `verify` and adds no Python dependency. `SignalClient(daemon, base_url)` signs and sends `POST /send/<to>` and long polls `GET /recv/<own id>`, with `
|
|
2462
|
+
9. **Bootstrap over the signalling service.** `letify/transport/linksignal.py` carries the `Bootstrap` of item 7 over the mailbox of [Signalling service](#link-signal). It uses the sidecar's `sign` and `verify` and adds no Python dependency. `SignalClient(daemon, base_url)` signs and sends `POST /send/<to>` and long polls `GET /recv/<own id>`, with `http.client` from the standard library on kept connections (Signalling service item 1, Connections). `SignalBootstrap(client, peer)` implements `send_line`, `recv_line`, `stderr_text`, `close` and `rtt_s`: each line is put in a signed envelope for the node `peer`, and each envelope received is verified as the Signalling service trust model lists, so a line that arrives unsigned, wrongly signed, stale, replayed or for another node is dropped and counted in `stderr_text`. A line whose envelope would pass 4096 bytes raises `OSError` naming the size and the cap, and is not split. The first line `connect_over` writes (the config line) is reduced to the lean config of Signalling service item 7. `SignalAgent` is the program on the address-less machine: it holds its own configuration (the `letify-link` binary, the Python, the paired node ids), reads its mailbox, runs `linkshim.py` for a paired node that sends a valid config line, and relays the shim's lines back in envelopes. The mailbox identity is the node key that signs the requests and envelopes of each side. On the local side it is the key file `connect_over` uses for its own sidecar, so the envelope's `from` is the node id the shim allows. The shim's sidecar has a throwaway key of its own, and its node id reaches the local side in the agent's signed `ready` line, which is how the local side learns whom to open the session with. A start that fails (the agent does not answer two pings in 30 s, the service is down) raises `ProviderUnavailable` with the reason from `connect_over`. Pairing and the persistent agent process are in [Agent and pairing](#link-agent); `SignalAgent` serves one paired node and its installation is not part of this item.
|
|
2460
2463
|
10. **Trace.** The sidecar writes a diagnostic trace only when asked. `LETIFY_LINK_TRACE=PATH` makes it append one JSON object per line to `PATH` for every open session, every `LETIFY_LINK_TRACE_MS` milliseconds (default 1000, at least 50). A binary built with `LETIFY_LINK_TRACE_DEFAULT=PATH` in its build environment uses `PATH` when `LETIFY_LINK_TRACE` is unset, which is how a binary that a bootstrap uploads to a remote machine is traced without an environment there. Without either the sidecar writes nothing and spawns no task. A binary built with `LETIFY_LINK_TRACE_MS_DEFAULT` does the same for the interval. A line holds `t_ms` (since the sidecar started), `unix_ms` (the wall clock), `session`, `cpu_ms` (user plus system time of the process, from `/proc/self/stat`, absent where that file is), the session's `unacked_bytes`, `reinjected` and `reorder_peak`, and `subflows`, one object per subflow with `id`, `sent`, `received`, `acked`, `inflight`, `window`, `bulk_cap`, `srtt_ms`, `delivery_rate` and, for a UDP path, `cwnd`, `lost` and `sent_packets`. Each subflow object also holds `kind` (`"tcp"`, `"udp"` or `"relay"`, from the path manager's `PathKinds` when the session has one, otherwise `"udp"` for a subflow that has a congestion gauge and `"tcp"` for one that has none), `gauged` (true when the subflow's transport reports congestion statistics, so `cwnd` and `lost` are absent exactly when `gauged` is false or no reading was taken yet), `window_limit` (the subflow's current window limit in bytes, between the configured window and `subflow_window_ceiling`) and `min_rtt_ms` (the lowest write to subflow ack time, `null` before the first). A UDP path gets a gauge whether the session received it directly or behind a `BoxTransport`, which is the form a punched candidate takes. The trace also writes an event line, which has `event` instead of `subflows`, when a subflow closes (`"event": "subflow_closed"` with `subflow`, `kind` and `reason`) and when the session fails (`"event": "session_failed"` with `reason`, the text `fail()` recorded). The reason of a closed subflow is `dead timeout: ...` when no record arrived for three keepalive intervals, `transport error: ...` when a read or write on the transport failed, `closed by caller` when `close_subflow` or `resume_now` dropped it (the path manager does so when it moves), and `session failed` when the session failed. An event line is written at the next sampling tick after the event and once only. The trace changes no behaviour of the session.
|
|
2461
2464
|
|
|
2462
2465
|
### Reverse SSH <!-- id: reverse-ssh -->
|
|
@@ -26,6 +26,7 @@ The terms used below:
|
|
|
26
26
|
|
|
27
27
|
- letify is installed on the agent machine (`uv add letify`).
|
|
28
28
|
- The `letify-link` binary is present. It ships in the platform wheels. When it is missing, the command fails with `letify-link is not in this wheel`. The environment variable `LETIFY_LINK_BIN` can name another executable.
|
|
29
|
+
- `nvidia-smi` is on the agent's `PATH`. letify reads the cards through it. On Kaggle it is in `/opt/bin`, so start the agent with `PATH=/opt/bin:$PATH letify agent serve`.
|
|
29
30
|
- The agent machine can open an outbound `https://` connection to the signalling service.
|
|
30
31
|
- The signalling service URL is `https://letify.darkpyonix.dev` unless you set another. In order of priority:
|
|
31
32
|
1. `letify agent serve --signal <URL>`
|
{letify-2.11.0 → letify-2.11.2}/docs/guide/ko/09-/354/227/220/354/235/264/354/240/204/355/212/270.md
RENAMED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
- 에이전트 머신에 letify가 설치되어 있습니다 (`uv add letify`).
|
|
28
28
|
- `letify-link` 바이너리가 있습니다. 플랫폼별 wheel에 들어 있습니다. 없으면 명령이 `letify-link is not in this wheel`로 실패합니다. 환경 변수 `LETIFY_LINK_BIN`으로 다른 실행 파일을 지정할 수 있습니다.
|
|
29
|
+
- 에이전트의 `PATH`에 `nvidia-smi`가 있습니다. letify는 이 명령으로 카드를 읽습니다. Kaggle에서는 `/opt/bin`에 있으므로 `PATH=/opt/bin:$PATH letify agent serve`로 에이전트를 시작합니다.
|
|
29
30
|
- 에이전트 머신에서 시그널링 서비스로 나가는 `https://` 연결이 가능합니다.
|
|
30
31
|
- 시그널링 서비스 URL은 따로 지정하지 않으면 `https://letify.darkpyonix.dev`입니다. 우선순위는 다음과 같습니다.
|
|
31
32
|
1. `letify agent serve --signal <URL>`
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Tunnel, a plain machine behind NAT with no provider API.
|
|
2
|
+
|
|
3
|
+
The machine's user runs ``letify client shell connect`` on it once. That starts the
|
|
4
|
+
remote agent behind ``tailcat serve`` and prints a Tailcat address and port, which go into
|
|
5
|
+
this account as ``tailcat`` and ``tailcat_port``. From there the connection pipeline in
|
|
6
|
+
``Shell`` does the rest: it reaches the agent over Tailcat, exchanges the TCP punch
|
|
7
|
+
mapping through it, and races the strategies as the spec describes. This class adds no
|
|
8
|
+
transport of its own; it exists so the configuration kind says what the machine is.
|
|
9
|
+
|
|
10
|
+
An account that names an ``agent`` (``letify agent serve``, spec "Agent and pairing" item 11)
|
|
11
|
+
is reached through the signalling service and a letify-link session, with no ssh and no
|
|
12
|
+
Tailcat.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import subprocess
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from ..errors import ProviderUnavailable, RuntimeFailure
|
|
21
|
+
from .shell import Shell
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Tunnel(Shell):
|
|
25
|
+
"""A machine behind NAT, reached through the remote agent."""
|
|
26
|
+
|
|
27
|
+
kind = "tunnel"
|
|
28
|
+
extra = "shell"
|
|
29
|
+
default_persistence = "ephemeral"
|
|
30
|
+
has_fast_path = True
|
|
31
|
+
#: Listing its workers would run the connection pipeline. Spec "Workers on a shell host".
|
|
32
|
+
discovers_sessions = False
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def agent(self) -> str | None:
|
|
36
|
+
"""The node id of the agent this account is paired with, or None for a Tailcat account."""
|
|
37
|
+
value = self.config.option("agent")
|
|
38
|
+
return value if isinstance(value, str) and value else None
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def address(self) -> str | None:
|
|
42
|
+
return None if self.agent else super().address
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def uses_letify_link(self) -> bool:
|
|
46
|
+
"""An agent account is always a letify-link account; ``link = "ssh"`` is refused."""
|
|
47
|
+
if self.agent is None:
|
|
48
|
+
return super().uses_letify_link
|
|
49
|
+
if self.config.option("link", "letify-link") not in (None, "letify-link"):
|
|
50
|
+
raise ProviderUnavailable(
|
|
51
|
+
self.kind,
|
|
52
|
+
f"{self.alias} names an agent and has no ssh server to reach; "
|
|
53
|
+
f"remove link = {self.config.option('link')!r}",
|
|
54
|
+
)
|
|
55
|
+
return True
|
|
56
|
+
|
|
57
|
+
def link(self, runtime: Any = None) -> Any:
|
|
58
|
+
"""The session's measurements with no ssh command, on an agent account."""
|
|
59
|
+
if self.agent is None:
|
|
60
|
+
return super().link(runtime)
|
|
61
|
+
from ..transport.linkchannel import PlainSshLink
|
|
62
|
+
|
|
63
|
+
links: dict[str, Any] = self.__dict__.setdefault("_links", {})
|
|
64
|
+
key = self._link_key(runtime)
|
|
65
|
+
if key not in links:
|
|
66
|
+
remotes = self.__dict__.setdefault("_link_remotes", {})
|
|
67
|
+
links[key] = PlainSshLink(None, lambda: remotes.get(key))
|
|
68
|
+
return links[key]
|
|
69
|
+
|
|
70
|
+
def connect_link(self, runtime: Any = None) -> Any:
|
|
71
|
+
"""A letify-link session bootstrapped through the agent and the signalling service."""
|
|
72
|
+
if self.agent is None:
|
|
73
|
+
return super().connect_link(runtime)
|
|
74
|
+
import letify
|
|
75
|
+
|
|
76
|
+
from ..config.secrets import account_directory
|
|
77
|
+
from ..protocol.worker import BOOTSTRAP
|
|
78
|
+
from ..transport import linkchannel
|
|
79
|
+
from ..transport.announce import printer
|
|
80
|
+
|
|
81
|
+
signal = self.config.option("signal")
|
|
82
|
+
if not (isinstance(signal, str) and signal):
|
|
83
|
+
raise ProviderUnavailable(
|
|
84
|
+
self.kind, f"{self.alias} names an agent but no signal URL; log in again"
|
|
85
|
+
)
|
|
86
|
+
directory = account_directory(self.alias)
|
|
87
|
+
directory.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
88
|
+
floor = self.link_floor
|
|
89
|
+
return linkchannel.connect_signal(
|
|
90
|
+
self.alias,
|
|
91
|
+
agent=self.agent,
|
|
92
|
+
signal=signal,
|
|
93
|
+
python=self.remote_python,
|
|
94
|
+
bootstrap=BOOTSTRAP,
|
|
95
|
+
key_path=directory / "link.key",
|
|
96
|
+
version=letify.__version__,
|
|
97
|
+
max_rtt_ms=floor.max_rtt_ms,
|
|
98
|
+
min_bps=floor.min_bps,
|
|
99
|
+
say=printer(self.announce),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def _run_helper(self, argv: list[str], timeout: float) -> subprocess.CompletedProcess[str]:
|
|
103
|
+
if self.agent is not None:
|
|
104
|
+
self.link_remote(None)
|
|
105
|
+
return super()._run_helper(argv, timeout)
|
|
106
|
+
|
|
107
|
+
def check(self) -> str:
|
|
108
|
+
"""Confirm the machine answers over the session and its workspace root is writable."""
|
|
109
|
+
if self.agent is None:
|
|
110
|
+
return super().check()
|
|
111
|
+
from ..runtime.bootstrap import workspace_check
|
|
112
|
+
|
|
113
|
+
root = self.workspace_root
|
|
114
|
+
script = (
|
|
115
|
+
"uname -a; nvidia-smi --query-gpu=name --format=csv,noheader; "
|
|
116
|
+
f"if letify_out=$({workspace_check(root)} 2>&1); then echo letify-workspace-ok; "
|
|
117
|
+
'else echo "letify-workspace-failed: $letify_out"; fi'
|
|
118
|
+
)
|
|
119
|
+
done = self._run_helper(["sh", "-c", script], 120)
|
|
120
|
+
if done.returncode != 0:
|
|
121
|
+
raise RuntimeFailure(
|
|
122
|
+
f"{self.alias} did not answer over letify-link", stderr=done.stderr.strip()
|
|
123
|
+
)
|
|
124
|
+
lines = []
|
|
125
|
+
for line in done.stdout.splitlines():
|
|
126
|
+
if line.strip() == "letify-workspace-ok":
|
|
127
|
+
lines.append(f"workspace {root}: writable")
|
|
128
|
+
elif line.startswith("letify-workspace-failed:"):
|
|
129
|
+
lines.append(f"workspace {root}: not writable: {line.split(':', 1)[1].strip()}")
|
|
130
|
+
else:
|
|
131
|
+
lines.append(line)
|
|
132
|
+
return "\n".join(lines) + "\n"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
__all__ = ["Tunnel"]
|
|
@@ -593,6 +593,64 @@ def connect_commands(
|
|
|
593
593
|
)
|
|
594
594
|
|
|
595
595
|
|
|
596
|
+
def connect_signal(
|
|
597
|
+
alias: str,
|
|
598
|
+
*,
|
|
599
|
+
agent: str,
|
|
600
|
+
signal: str,
|
|
601
|
+
python: str,
|
|
602
|
+
bootstrap: str,
|
|
603
|
+
key_path: str | os.PathLike[str],
|
|
604
|
+
version: str,
|
|
605
|
+
max_rtt_ms: float | None = None,
|
|
606
|
+
min_bps: float | None = None,
|
|
607
|
+
start_timeout_ms: int = 60_000,
|
|
608
|
+
say: Say = quiet,
|
|
609
|
+
) -> LinkRemote:
|
|
610
|
+
"""Bootstrap through the signalling service and a paired agent, and return the machine.
|
|
611
|
+
|
|
612
|
+
Spec "Agent and pairing" item 11. The agent holds the binary of its own machine, so nothing
|
|
613
|
+
is prepared. The machine has no address, so the session starts from punched candidates only.
|
|
614
|
+
"""
|
|
615
|
+
from . import linksignal
|
|
616
|
+
|
|
617
|
+
try:
|
|
618
|
+
signer = linkd.LinkDaemon(key_path)
|
|
619
|
+
except linkd.LinkMissing as error:
|
|
620
|
+
raise _fail(alias, str(error)) from error
|
|
621
|
+
except linkd.LinkError as error:
|
|
622
|
+
raise _fail(alias, f"the local sidecar failed: {error}") from error
|
|
623
|
+
client = linksignal.SignalClient(signer, signal)
|
|
624
|
+
|
|
625
|
+
def start() -> Bootstrap:
|
|
626
|
+
stream = linksignal.SignalBootstrap(client, agent, version=version)
|
|
627
|
+
try:
|
|
628
|
+
stream.start()
|
|
629
|
+
except OSError as error:
|
|
630
|
+
raise _fail(alias, str(error)) from error
|
|
631
|
+
return stream
|
|
632
|
+
|
|
633
|
+
try:
|
|
634
|
+
return connect_over(
|
|
635
|
+
alias,
|
|
636
|
+
prepare=lambda: "",
|
|
637
|
+
start=start,
|
|
638
|
+
address=None,
|
|
639
|
+
python=python,
|
|
640
|
+
bootstrap=bootstrap,
|
|
641
|
+
key_path=key_path,
|
|
642
|
+
punch=True,
|
|
643
|
+
max_rtt_ms=max_rtt_ms,
|
|
644
|
+
min_bps=min_bps,
|
|
645
|
+
start_timeout_ms=start_timeout_ms,
|
|
646
|
+
say=say,
|
|
647
|
+
note={"how": "the agent"},
|
|
648
|
+
channel="the signalling service",
|
|
649
|
+
)
|
|
650
|
+
finally:
|
|
651
|
+
signer.close()
|
|
652
|
+
|
|
653
|
+
|
|
596
654
|
def _started(mailbox: Any) -> Any:
|
|
597
655
|
mailbox.start()
|
|
598
656
|
return mailbox
|
|
@@ -1195,6 +1253,7 @@ __all__ = [
|
|
|
1195
1253
|
"connect",
|
|
1196
1254
|
"connect_commands",
|
|
1197
1255
|
"connect_over",
|
|
1256
|
+
"connect_signal",
|
|
1198
1257
|
"letify_link_enabled",
|
|
1199
1258
|
"prepare_binary",
|
|
1200
1259
|
"punch_lead_ms",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""A letify-link bootstrap carried over the signalling service's mailbox.
|
|
2
2
|
|
|
3
|
-
Owns talking to the signalling service (signed requests
|
|
4
|
-
WebSocket watch of a standing wait), the signed envelope that
|
|
3
|
+
Owns talking to the signalling service (signed requests on kept HTTP connections, the short
|
|
4
|
+
long poll of a connect, the WebSocket watch of a standing wait), the signed envelope that
|
|
5
5
|
wraps every bootstrap line, ``SignalBootstrap`` (the ``Bootstrap`` of ``linkchannel.py`` over
|
|
6
6
|
that mailbox) and ``SignalAgent`` (the program on the address-less machine that serves a paired
|
|
7
7
|
node's bootstrap). It does not own the service (``letify-signal/``), signing (the sidecar's
|
|
@@ -14,6 +14,7 @@ from __future__ import annotations
|
|
|
14
14
|
import base64
|
|
15
15
|
import contextlib
|
|
16
16
|
import hashlib
|
|
17
|
+
import http.client
|
|
17
18
|
import json
|
|
18
19
|
import queue
|
|
19
20
|
import re
|
|
@@ -28,7 +29,7 @@ from collections.abc import Callable, Iterable
|
|
|
28
29
|
from dataclasses import dataclass
|
|
29
30
|
from typing import Any, Protocol
|
|
30
31
|
|
|
31
|
-
from . import linkwebsocket
|
|
32
|
+
from . import linkd, linkwebsocket
|
|
32
33
|
|
|
33
34
|
#: The service the owner operates.
|
|
34
35
|
DEFAULT_URL = "https://letify.darkpyonix.dev"
|
|
@@ -55,6 +56,8 @@ SHIM_OPS = ("rendezvous", "punch", "handover")
|
|
|
55
56
|
#: Bounds of the WebSocket keepalive, in seconds. See ``linkwebsocket``.
|
|
56
57
|
WS_PING_S = linkwebsocket.PING_S
|
|
57
58
|
WS_PONG_S = linkwebsocket.PONG_S
|
|
59
|
+
#: Idle HTTP connections a client keeps. Spec "Signalling service" item 1, "Connections".
|
|
60
|
+
MAX_IDLE = 4
|
|
58
61
|
#: Transient failures of the long poll a bootstrap rides out before it gives up.
|
|
59
62
|
POLL_RETRIES = 3
|
|
60
63
|
|
|
@@ -100,6 +103,25 @@ def _user_agent() -> str:
|
|
|
100
103
|
return f"letify/{__version__}"
|
|
101
104
|
|
|
102
105
|
|
|
106
|
+
def _proxied(url: str) -> bool:
|
|
107
|
+
"""Whether the environment sends a request for ``url`` through a proxy."""
|
|
108
|
+
parts = urllib.parse.urlsplit(url)
|
|
109
|
+
host = parts.hostname or ""
|
|
110
|
+
if host in ("127.0.0.1", "localhost", "::1"):
|
|
111
|
+
return False
|
|
112
|
+
return parts.scheme in urllib.request.getproxies() and not urllib.request.proxy_bypass(host)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
#: Failures of a reused connection that mean the service had already closed it.
|
|
116
|
+
_STALE = (
|
|
117
|
+
http.client.RemoteDisconnected,
|
|
118
|
+
http.client.CannotSendRequest,
|
|
119
|
+
ConnectionResetError,
|
|
120
|
+
ConnectionAbortedError,
|
|
121
|
+
BrokenPipeError,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
103
125
|
def _opener(url: str) -> urllib.request.OpenerDirector:
|
|
104
126
|
"""An opener that never sends a loopback request through a proxy."""
|
|
105
127
|
host = urllib.parse.urlsplit(url).hostname or ""
|
|
@@ -126,6 +148,19 @@ class SignalClient:
|
|
|
126
148
|
self._nonce = nonce or (lambda: secrets.token_hex(16))
|
|
127
149
|
self._timeout = timeout
|
|
128
150
|
self._opener = _opener(self.base_url)
|
|
151
|
+
parts = urllib.parse.urlsplit(self.base_url)
|
|
152
|
+
self._scheme = parts.scheme
|
|
153
|
+
self._netloc = parts.netloc
|
|
154
|
+
self._proxied = _proxied(self.base_url)
|
|
155
|
+
self._idle: list[http.client.HTTPConnection] = []
|
|
156
|
+
self._idle_lock = threading.Lock()
|
|
157
|
+
|
|
158
|
+
def close(self) -> None:
|
|
159
|
+
"""Close the idle connections. A later request opens a new one."""
|
|
160
|
+
with self._idle_lock:
|
|
161
|
+
idle, self._idle = self._idle, []
|
|
162
|
+
for connection in idle:
|
|
163
|
+
connection.close()
|
|
129
164
|
|
|
130
165
|
@property
|
|
131
166
|
def node_id(self) -> str:
|
|
@@ -146,6 +181,54 @@ class SignalClient:
|
|
|
146
181
|
"X-Letify-Signature": signature.hex(),
|
|
147
182
|
}
|
|
148
183
|
|
|
184
|
+
def _take(self) -> tuple[http.client.HTTPConnection, bool]:
|
|
185
|
+
"""An idle connection and True, or a new one and False."""
|
|
186
|
+
with self._idle_lock:
|
|
187
|
+
if self._idle:
|
|
188
|
+
return self._idle.pop(), True
|
|
189
|
+
factory = (
|
|
190
|
+
http.client.HTTPSConnection if self._scheme == "https" else http.client.HTTPConnection
|
|
191
|
+
)
|
|
192
|
+
return factory(self._netloc), False
|
|
193
|
+
|
|
194
|
+
def _give_back(self, connection: http.client.HTTPConnection) -> None:
|
|
195
|
+
with self._idle_lock:
|
|
196
|
+
if len(self._idle) < MAX_IDLE:
|
|
197
|
+
self._idle.append(connection)
|
|
198
|
+
return
|
|
199
|
+
connection.close()
|
|
200
|
+
|
|
201
|
+
def _exchange(
|
|
202
|
+
self, method: str, target: str, body: bytes, timeout: float, signer_id: str | None
|
|
203
|
+
) -> tuple[int, Any, bytes]:
|
|
204
|
+
"""One request on a kept connection: status, headers and the whole reply body."""
|
|
205
|
+
for _ in range(2):
|
|
206
|
+
connection, reused = self._take()
|
|
207
|
+
headers = self._headers(method, target, body, signer_id)
|
|
208
|
+
connection.timeout = timeout
|
|
209
|
+
if connection.sock is not None:
|
|
210
|
+
connection.sock.settimeout(timeout)
|
|
211
|
+
try:
|
|
212
|
+
connection.request(
|
|
213
|
+
method, target, body=body if method == "POST" else None, headers=headers
|
|
214
|
+
)
|
|
215
|
+
response = connection.getresponse()
|
|
216
|
+
data = response.read()
|
|
217
|
+
except _STALE:
|
|
218
|
+
connection.close()
|
|
219
|
+
if reused:
|
|
220
|
+
continue
|
|
221
|
+
raise
|
|
222
|
+
except BaseException:
|
|
223
|
+
connection.close()
|
|
224
|
+
raise
|
|
225
|
+
if response.will_close:
|
|
226
|
+
connection.close()
|
|
227
|
+
else:
|
|
228
|
+
self._give_back(connection)
|
|
229
|
+
return response.status, response.headers, data
|
|
230
|
+
raise AssertionError("unreachable") # pragma: no cover
|
|
231
|
+
|
|
149
232
|
def _request(
|
|
150
233
|
self,
|
|
151
234
|
method: str,
|
|
@@ -155,6 +238,33 @@ class SignalClient:
|
|
|
155
238
|
timeout: float,
|
|
156
239
|
signer_id: str | None = None,
|
|
157
240
|
) -> dict[str, Any]:
|
|
241
|
+
if self._proxied:
|
|
242
|
+
return self._request_urllib(method, target, body, timeout, signer_id)
|
|
243
|
+
try:
|
|
244
|
+
status, headers, data = self._exchange(method, target, body, timeout, signer_id)
|
|
245
|
+
if status >= 400:
|
|
246
|
+
code = "unknown"
|
|
247
|
+
with contextlib.suppress(ValueError, OSError, AttributeError):
|
|
248
|
+
code = str(json.loads(data).get("error", code))
|
|
249
|
+
raise self._refused(status, code, headers.get("Retry-After"))
|
|
250
|
+
return json.loads(data) # type: ignore[no-any-return]
|
|
251
|
+
except SignalError:
|
|
252
|
+
raise
|
|
253
|
+
except (http.client.HTTPException, TimeoutError, OSError, ValueError) as error:
|
|
254
|
+
reason = getattr(error, "reason", error)
|
|
255
|
+
raise SignalError(f"the signalling service did not answer: {reason}") from error
|
|
256
|
+
|
|
257
|
+
@staticmethod
|
|
258
|
+
def _refused(status: int, code: str, retry: str | None) -> SignalError:
|
|
259
|
+
return SignalError(
|
|
260
|
+
f"the signalling service refused the request: {code} (HTTP {status}"
|
|
261
|
+
+ (f", retry in {retry} s)" if retry else ")")
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
def _request_urllib(
|
|
265
|
+
self, method: str, target: str, body: bytes, timeout: float, signer_id: str | None
|
|
266
|
+
) -> dict[str, Any]:
|
|
267
|
+
"""The request through ``urllib``, with a new connection, for a proxied service."""
|
|
158
268
|
headers = self._headers(method, target, body, signer_id)
|
|
159
269
|
request = urllib.request.Request(
|
|
160
270
|
self.base_url + target, data=body if method == "POST" else None, method=method
|
|
@@ -168,11 +278,7 @@ class SignalClient:
|
|
|
168
278
|
code = "unknown"
|
|
169
279
|
with contextlib.suppress(ValueError, OSError):
|
|
170
280
|
code = str(json.loads(error.read()).get("error", code))
|
|
171
|
-
|
|
172
|
-
raise SignalError(
|
|
173
|
-
f"the signalling service refused the request: {code} (HTTP {error.code}"
|
|
174
|
-
+ (f", retry in {retry} s)" if retry else ")")
|
|
175
|
-
) from error
|
|
281
|
+
raise self._refused(error.code, code, error.headers.get("Retry-After")) from error
|
|
176
282
|
except (urllib.error.URLError, TimeoutError, OSError, ValueError) as error:
|
|
177
283
|
reason = getattr(error, "reason", error)
|
|
178
284
|
raise SignalError(f"the signalling service did not answer: {reason}") from error
|
|
@@ -210,7 +316,6 @@ class SignalClient:
|
|
|
210
316
|
"""Acknowledge up to ``after``, then wait up to ``wait_s`` for a message above it."""
|
|
211
317
|
return self.recv_from(self.daemon.node_id, after, wait_s)
|
|
212
318
|
|
|
213
|
-
|
|
214
319
|
def watch(self) -> SignalWatch:
|
|
215
320
|
"""A standing wait on this node's mailbox over ``/ws/<node>``, for an idle receiver."""
|
|
216
321
|
return SignalWatch(self)
|
|
@@ -502,7 +607,7 @@ class SignalBootstrap:
|
|
|
502
607
|
while not self._stop.is_set():
|
|
503
608
|
try:
|
|
504
609
|
messages, _ = self._client.recv(after, wait_s=POLL_S)
|
|
505
|
-
except SignalError as error:
|
|
610
|
+
except (SignalError, linkd.LinkError) as error:
|
|
506
611
|
failures += 1
|
|
507
612
|
if self._stop.is_set():
|
|
508
613
|
return
|
|
@@ -396,11 +396,11 @@ dependencies = [
|
|
|
396
396
|
|
|
397
397
|
[[package]]
|
|
398
398
|
name = "letify"
|
|
399
|
-
version = "2.11.
|
|
399
|
+
version = "2.11.2"
|
|
400
400
|
|
|
401
401
|
[[package]]
|
|
402
402
|
name = "letify-link"
|
|
403
|
-
version = "2.11.
|
|
403
|
+
version = "2.11.2"
|
|
404
404
|
dependencies = [
|
|
405
405
|
"ed25519-dalek",
|
|
406
406
|
"getrandom 0.2.17",
|
|
@@ -416,7 +416,7 @@ dependencies = [
|
|
|
416
416
|
|
|
417
417
|
[[package]]
|
|
418
418
|
name = "letify-quic"
|
|
419
|
-
version = "2.11.
|
|
419
|
+
version = "2.11.2"
|
|
420
420
|
dependencies = [
|
|
421
421
|
"quinn",
|
|
422
422
|
"rcgen",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "letify-status",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "letify-status",
|
|
9
|
-
"version": "2.11.
|
|
9
|
+
"version": "2.11.2",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/node": "^18.19.0",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "letify-status",
|
|
3
3
|
"displayName": "letify Status",
|
|
4
4
|
"description": "letify quota and GPU activity in the status bar, read from the letify CLI.",
|
|
5
|
-
"version": "2.11.
|
|
5
|
+
"version": "2.11.2",
|
|
6
6
|
"publisher": "darkpyonix",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"repository": {
|
|
@@ -1278,8 +1278,11 @@ class FakeDriveServer:
|
|
|
1278
1278
|
if len(session["body"]) >= session["size"]:
|
|
1279
1279
|
identifier = self._new_id()
|
|
1280
1280
|
self.files[identifier] = {
|
|
1281
|
-
**session["meta"],
|
|
1282
|
-
"
|
|
1281
|
+
**session["meta"],
|
|
1282
|
+
"id": identifier,
|
|
1283
|
+
"content": session["body"],
|
|
1284
|
+
"folder": False,
|
|
1285
|
+
"trashed": False,
|
|
1283
1286
|
}
|
|
1284
1287
|
session["id"] = identifier
|
|
1285
1288
|
if glitch == "drop-after-store":
|
|
@@ -2375,9 +2378,21 @@ class FakeSignalService:
|
|
|
2375
2378
|
self.answer_pings = True
|
|
2376
2379
|
#: Set by ``close``, so a WebSocket still in its handshake is cut once it registers.
|
|
2377
2380
|
self._closed = False
|
|
2381
|
+
#: TCP connections accepted, and the ones still open (for ``drop_connections``).
|
|
2382
|
+
self.connections = 0
|
|
2383
|
+
self._open: list[Any] = []
|
|
2378
2384
|
service = self
|
|
2379
2385
|
|
|
2380
2386
|
class Handler(http.server.BaseHTTPRequestHandler):
|
|
2387
|
+
# Keep-alive, as the Cloudflare edge serves it.
|
|
2388
|
+
protocol_version = "HTTP/1.1"
|
|
2389
|
+
|
|
2390
|
+
def setup(self) -> None:
|
|
2391
|
+
super().setup()
|
|
2392
|
+
with service._cond:
|
|
2393
|
+
service.connections += 1
|
|
2394
|
+
service._open.append(self.connection)
|
|
2395
|
+
|
|
2381
2396
|
def log_message(self, *args: Any) -> None:
|
|
2382
2397
|
pass
|
|
2383
2398
|
|
|
@@ -2396,9 +2411,20 @@ class FakeSignalService:
|
|
|
2396
2411
|
with self._cond:
|
|
2397
2412
|
self._closed = True
|
|
2398
2413
|
self.drop_sockets()
|
|
2414
|
+
# A keep-alive connection outlives server shutdown in its handler thread; a
|
|
2415
|
+
# service that is gone answers on none of them.
|
|
2416
|
+
self.drop_connections()
|
|
2399
2417
|
self._server.shutdown()
|
|
2400
2418
|
self._server.server_close()
|
|
2401
2419
|
|
|
2420
|
+
def drop_connections(self) -> None:
|
|
2421
|
+
"""Close every open HTTP connection from the server side, as an idle timeout does."""
|
|
2422
|
+
with self._cond:
|
|
2423
|
+
open_now, self._open = self._open, []
|
|
2424
|
+
for conn in open_now:
|
|
2425
|
+
with contextlib.suppress(OSError):
|
|
2426
|
+
conn.shutdown(socket.SHUT_RDWR)
|
|
2427
|
+
|
|
2402
2428
|
def drop_sockets(self) -> None:
|
|
2403
2429
|
"""Cut every open WebSocket without a close frame, as a network failure does."""
|
|
2404
2430
|
with self._cond:
|