| … | … | @@ -0,0 +1,80 @@ |
| 1 | # p2p-bridge |
| 2 | |
| 3 | CogServer over Hyperswarm — reach a remote [AtomSpace](../repos/atomspace) as if it were on |
| 4 | localhost, with no port forwarding, no static IP and no key exchange. |
| 5 | |
| 6 | ``` |
| 7 | CogStorageNode ─TCP─► bridge client ─Hyperswarm─► bridge server ─TCP─► CogServer |
| 8 | ``` |
| 9 | |
| 10 | Package name is `atomspace-p2p-bridge`; the binary is `atomspace-bridge`. |
| 11 | |
| 12 | ## Identity-first: both sides derive the same topic |
| 13 | |
| 14 | There is no key to copy between machines. Both ends name the same |
| 15 | [hyperident](../../hyper-fleeky/hyperident) profile and arrive at the same DHT topic: |
| 16 | |
| 17 | ``` |
| 18 | hyperident mnemonic → SLIP-21(profileName) → seed |
| 19 | seed + "atomspace-bridge" salt → Ed25519 keypair |
| 20 | discoveryKey(publicKey) → DHT topic |
| 21 | ``` |
| 22 | |
| 23 | ## Usage |
| 24 | |
| 25 | ```sh |
| 26 | # on the CogServer machine |
| 27 | node bridge.js server --profile tabertron |
| 28 | |
| 29 | # anywhere else |
| 30 | node bridge.js client --profile tabertron |
| 31 | ``` |
| 32 | |
| 33 | Then in Guile: |
| 34 | |
| 35 | ```scheme |
| 36 | (define csn (CogStorageNode "cog://localhost:17002/")) |
| 37 | (cog-open csn) |
| 38 | ``` |
| 39 | |
| 40 | Without hyperident, fall back to raw keys: |
| 41 | |
| 42 | ```sh |
| 43 | node bridge.js server --seed <64-hex-chars> |
| 44 | node bridge.js client <public-key> |
| 45 | ``` |
| 46 | |
| 47 | ## Options |
| 48 | |
| 49 | **Identity — pick one** |
| 50 | |
| 51 | | | | |
| 52 | |---|---| |
| 53 | | `--profile <name>` | hyperident profile (recommended) | |
| 54 | | `--seed <hex>` | raw 64-char hex seed | |
| 55 | |
| 56 | **Server** |
| 57 | |
| 58 | | | | |
| 59 | |---|---| |
| 60 | | `--port <n>` | CogServer port (default `17001`) | |
| 61 | | `--testnet <file>` | use a local testnet | |
| 62 | |
| 63 | **Client** |
| 64 | |
| 65 | | | | |
| 66 | |---|---| |
| 67 | | `--proxy-port <n>` | local proxy port (default `17002`) | |
| 68 | | `--testnet <file>` | must match the server's | |
| 69 | |
| 70 | ## Notes |
| 71 | |
| 72 | - `hyperident` is ESM and loaded dynamically; if it is absent the bridge still runs, but only |
| 73 | the `--seed` / explicit-pubkey path works. |
| 74 | - Transport is Protomux over a Hyperswarm connection, protocol `atomspace-proxy`. |
| 75 | - `test-bridge.js`, `test-connect.js` and `test-production-dht.js` are scripts, not a suite — |
| 76 | run them directly. |
| 77 | |
| 78 | ## License |
| 79 | |
| 80 | Not yet declared. |