Update site to include updates about service subscriptions
This commit is contained in:
@@ -494,6 +494,121 @@ export default function HowItWorksPage() {
|
||||
<strong className="text-gray-900 dark:text-white">The magic:</strong> Even though Alice and Bob are both behind firewalls and NAT,
|
||||
they can communicate directly thanks to Holesail's UDP hole-punching. No central server needed, no port forwarding required!
|
||||
</p>
|
||||
|
||||
<h3 className="text-2xl font-semibold text-gray-900 dark:text-white mb-4 mt-8">Scenario: Service Subscriptions - Multiple Services, Automatic Management</h3>
|
||||
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
||||
Service subscriptions allow peers to automatically connect to services hosted by domain owners. This is especially useful when
|
||||
a domain owner hosts multiple services (like a web server, API, and game server) and wants others to easily access them.
|
||||
</p>
|
||||
|
||||
<div className="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg mb-6">
|
||||
<h4 className="text-xl font-semibold text-gray-900 dark:text-white mb-3">Step 1: Alice Hosts Multiple Services</h4>
|
||||
<ul className="list-disc pl-6 space-y-2 text-gray-700 dark:text-gray-300 mb-4">
|
||||
<li>Alice owns the domain <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services</code></li>
|
||||
<li>She hosts three services:
|
||||
<ul className="list-disc pl-6 mt-2 space-y-1">
|
||||
<li><strong>Web Server:</strong> Port 80, TCP protocol, service name "web"</li>
|
||||
<li><strong>API Server:</strong> Port 8080, TCP protocol, service name "api"</li>
|
||||
<li><strong>Game Server:</strong> Port 25565, UDP protocol, service name "game"</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Alice opens the P2NS admin panel and navigates to the "Host" tab</li>
|
||||
<li>For each service, she creates a Holesail hash and uses the "Create Client" button to add it to her domain</li>
|
||||
<li>When creating each client, she specifies the service name and protocol (TCP or UDP)</li>
|
||||
<li>The system automatically updates the domain's claim record with a <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">clients</code> array containing all three services</li>
|
||||
<li>This claim record is automatically synced to all peers in the network</li>
|
||||
</ul>
|
||||
<p className="text-gray-600 dark:text-gray-300 mb-4 mt-4">
|
||||
Example claim record structure:
|
||||
</p>
|
||||
<CodeBlock code={'{\n "hash": "original-hash",\n "clients": [\n {\n "name": "web",\n "hash": "hs://s00084bf87dfa89a...",\n "protocol": "tcp"\n },\n {\n "name": "api",\n "hash": "hs://s00091c2e8fa9b0b...",\n "protocol": "tcp"\n },\n {\n "name": "game",\n "hash": "hs://s000a2d3f9b1c2d3...",\n "protocol": "udp"\n }\n ],\n "timestamp": 1234567890\n}'} language="json" />
|
||||
|
||||
<h4 className="text-xl font-semibold text-gray-900 dark:text-white mb-3 mt-6">Step 2: Bob Discovers and Subscribes to Services</h4>
|
||||
<ul className="list-disc pl-6 space-y-2 text-gray-700 dark:text-gray-300 mb-4">
|
||||
<li>Bob opens the P2NS admin panel and navigates to the "Service Subscription" modal</li>
|
||||
<li>He searches for <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services</code> and sees all three available services</li>
|
||||
<li>Bob has two options:
|
||||
<ul className="list-disc pl-6 mt-2 space-y-1">
|
||||
<li><strong>Subscribe to individual services:</strong> He selects just the "web" and "api" services</li>
|
||||
<li><strong>Subscribe to all:</strong> He enables "Subscribe All" for <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bob chooses "Subscribe All" - this means he'll automatically get all current and future services from Alice</li>
|
||||
<li>P2NS automatically creates Holesail clients for all three services:
|
||||
<ul className="list-disc pl-6 mt-2 space-y-1">
|
||||
<li><code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services_web</code> (TCP client)</li>
|
||||
<li><code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services_api</code> (TCP client)</li>
|
||||
<li><code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services_game</code> (UDP client)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Each client establishes a Holesail connection to the corresponding service</li>
|
||||
<li>Bob's subscription preferences are saved locally in <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">subscriptions.json</code></li>
|
||||
</ul>
|
||||
|
||||
<h4 className="text-xl font-semibold text-gray-900 dark:text-white mb-3 mt-6">Step 3: Dynamic Synchronization - Alice Adds a New Service</h4>
|
||||
<ul className="list-disc pl-6 space-y-2 text-gray-700 dark:text-gray-300 mb-4">
|
||||
<li>Later, Alice adds a fourth service: "chat" server on port 9000 (TCP)</li>
|
||||
<li>She uses the admin panel's "Create Client" button to add the new service to her domain</li>
|
||||
<li>The system automatically updates her domain's claim record to include the new service</li>
|
||||
<li>The updated claim record is automatically synced to all peers</li>
|
||||
<li>Bob's P2NS node detects the change in the claim record (via AutoPass update events)</li>
|
||||
<li>Since Bob has "Subscribe All" enabled for <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services</code>, P2NS automatically:
|
||||
<ul className="list-disc pl-6 mt-2 space-y-1">
|
||||
<li>Creates a new Holesail client: <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services_chat</code></li>
|
||||
<li>Establishes the connection</li>
|
||||
<li>Updates Bob's subscription list</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bob can now access the chat service without any manual configuration!</li>
|
||||
</ul>
|
||||
|
||||
<h4 className="text-xl font-semibold text-gray-900 dark:text-white mb-3 mt-6">Step 4: Dynamic Synchronization - Alice Removes a Service</h4>
|
||||
<ul className="list-disc pl-6 space-y-2 text-gray-700 dark:text-gray-300 mb-4">
|
||||
<li>Alice decides to shut down her "game" server</li>
|
||||
<li>She uses the admin panel to delete the Holesail client for the "game" service</li>
|
||||
<li>The system automatically removes it from her domain's claim record</li>
|
||||
<li>The updated claim record syncs to all peers</li>
|
||||
<li>Bob's P2NS node detects the service was removed</li>
|
||||
<li>P2NS automatically:
|
||||
<ul className="list-disc pl-6 mt-2 space-y-1">
|
||||
<li>Stops and deletes the <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">alice.services_game</code> Holesail client</li>
|
||||
<li>Frees up the UDP port that was being used</li>
|
||||
<li>Removes the service from Bob's subscription list</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bob's system is automatically cleaned up - no manual intervention needed!</li>
|
||||
</ul>
|
||||
|
||||
<h4 className="text-xl font-semibold text-gray-900 dark:text-white mb-3 mt-6">Step 5: Auto-Subscription on Bootup</h4>
|
||||
<ul className="list-disc pl-6 space-y-2 text-gray-700 dark:text-gray-300 mb-4">
|
||||
<li>When Bob restarts his P2NS node, the system loads his saved subscriptions from <code className="bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded">subscriptions.json</code></li>
|
||||
<li>For each subscribed service, P2NS automatically:
|
||||
<ul className="list-disc pl-6 mt-2 space-y-1">
|
||||
<li>Creates the Holesail client</li>
|
||||
<li>Establishes the connection</li>
|
||||
<li>Makes the service available immediately</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If "Subscribe All" is enabled for a domain, P2NS also checks the current claim record and subscribes to any new services that were added while Bob's node was offline</li>
|
||||
<li>Bob doesn't need to manually reconfigure anything - everything just works!</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
||||
<strong className="text-gray-900 dark:text-white">Key Benefits:</strong>
|
||||
</p>
|
||||
<ul className="list-disc pl-6 space-y-2 text-gray-600 dark:text-gray-300 mb-4">
|
||||
<li><strong className="text-gray-900 dark:text-white">Automatic Management:</strong> Services are automatically added/removed as domain owners update their offerings</li>
|
||||
<li><strong className="text-gray-900 dark:text-white">Persistent Subscriptions:</strong> Subscriptions survive reboots and are automatically restored</li>
|
||||
<li><strong className="text-gray-900 dark:text-white">Protocol Support:</strong> Works with both TCP and UDP services</li>
|
||||
<li><strong className="text-gray-900 dark:text-white">Subscribe All:</strong> Option to automatically get all services from a domain, including future ones</li>
|
||||
<li><strong className="text-gray-900 dark:text-white">No Manual Configuration:</strong> Once subscribed, everything is managed automatically</li>
|
||||
</ul>
|
||||
<p className="text-gray-600 dark:text-gray-300 mb-6">
|
||||
<strong className="text-gray-900 dark:text-white">The Power:</strong> Service subscriptions make it easy for peers to discover and connect to services across the network.
|
||||
Domain owners can offer multiple services, and subscribers can automatically access them all with minimal configuration.
|
||||
The system handles all the complexity of connection management, protocol differences, and dynamic updates.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user