### Development Quickstart Commands Source: https://github.com/getlantern/unbounded/blob/main/README.md Commands to set up and start the development server for the Unbounded UI. This includes installing dependencies, copying example environment files, and running the development server. ```bash cd ui yarn cp .env.development.example .env.development yarn dev:web ``` -------------------------------- ### Start Widget with netstate Tagging Source: https://github.com/getlantern/unbounded/blob/main/README.md Starts a widget and assigns it a user-defined tag for network observation. Requires NETSTATED, FREDDIE, and EGRESS environment variables to be set. Executable is in 'cmd/dist/bin'. ```shell cd cmd/dist/bin && NETSTATED=http://localhost:8080/exec TAG=Alice FREDDIE=http://localhost:9000 EGRESS=http://localhost:8000 ./widget ``` -------------------------------- ### Start Docker Compose Source: https://github.com/getlantern/unbounded/blob/main/ui/wp-plugin/README.md Starts the Docker containers defined in the docker-compose.yml file in detached mode. This is the initial step to get the WordPress environment running. ```bash docker-compose up -d ``` -------------------------------- ### Start Desktop Client with netstate Tagging Source: https://github.com/getlantern/unbounded/blob/main/README.md Launches a desktop client and assigns it a user-defined tag for network observation. Requires NETSTATED, FREDDIE, and EGRESS environment variables. Executable is in 'cmd/dist/bin'. ```shell cd cmd/dist/bin && NETSTATED=http://localhost:8080/exec TAG=Bob FREDDIE=http://localhost:9000 EGRESS=http://localhost:8000 ./desktop ``` -------------------------------- ### Start Native Binary Widget Source: https://github.com/getlantern/unbounded/blob/main/README.md Launches a native binary widget for the Unbounded network. This requires FREDDIE and EGRESS environment variables to be configured. The widget executable is found in 'cmd/dist/bin'. ```shell cd cmd/dist/bin && FREDDIE=http://localhost:9000 EGRESS=http://localhost:8000 ./widget ``` -------------------------------- ### Start Desktop Client Source: https://github.com/getlantern/unbounded/blob/main/README.md Launches a desktop client for the Unbounded network. It requires FREDDIE and EGRESS environment variables to be set, pointing to the respective service addresses. The executable is located in 'cmd/dist/bin'. ```shell cd cmd/dist/bin && FREDDIE=http://localhost:9000 EGRESS=http://localhost:8000 ./desktop ``` -------------------------------- ### Create Plugin Directory Source: https://github.com/getlantern/unbounded/blob/main/ui/wp-plugin/README.md Creates a new directory within the WordPress content plugins directory to house the Browsers Unbounded plugin files. This prepares the structure for plugin installation. ```bash mkdir ./wp-content/plugins/browsers-unbounded-plugin ``` -------------------------------- ### Example Production Embed HTML Source: https://github.com/getlantern/unbounded/blob/main/README.md An example of how to embed the Unbounded widget in production using a custom HTML element and a script tag. This demonstrates passing configuration options via data-* attributes. ```html ``` -------------------------------- ### Start Egress Server Source: https://github.com/getlantern/unbounded/blob/main/README.md Starts the egress server, responsible for handling outgoing network traffic. The PORT environment variable allows customization of the listening port. Navigate to the 'egress/cmd' directory before running. ```shell cd egress/cmd && PORT=8000 go run egress.go ``` -------------------------------- ### Copy Plugin File Source: https://github.com/getlantern/unbounded/blob/main/ui/wp-plugin/README.md Copies the main plugin PHP file into the newly created plugin directory. This action places the plugin's core code into its designated location within the WordPress installation. ```bash cp browsers-unbounded-plugin.php ./wp-content/plugins/browsers-unbounded-plugin/ ``` -------------------------------- ### Start Freddie Service Source: https://github.com/getlantern/unbounded/blob/main/README.md Starts the Freddie service, which is a core component of the Unbounded network. The PORT environment variable can be used to specify the listening port. Execution should be from the 'freddie/cmd' directory. ```shell cd freddie/cmd && PORT=9000 go run main.go ``` -------------------------------- ### Start netstated Service Source: https://github.com/getlantern/unbounded/blob/main/README.md Initiates the netstated service, a distributed state machine for observing Unbounded networks. It collects state changes and serves network visualizations. Run from the 'netstate/d' directory. ```shell cd netstate/d && go run netstated.go ``` -------------------------------- ### Build Native Binaries with build.sh Source: https://github.com/getlantern/unbounded/blob/main/README.md This script compiles the native binary desktop client and widget for the Unbounded project. It requires navigating to the 'cmd' directory before execution. ```shell cd cmd && ./build.sh desktop cd cmd && ./build.sh widget ``` -------------------------------- ### Build Browser Widget with build_web.sh Source: https://github.com/getlantern/unbounded/blob/main/README.md This script builds the browser-compatible widget for the Unbounded project. The command should be executed from the 'cmd' directory. ```shell cd cmd && ./build_web.sh ``` -------------------------------- ### Production Build and Deploy Commands Source: https://github.com/getlantern/unbounded/blob/main/README.md Commands to build the production bundle and deploy it to GitHub Pages for the Unbounded UI. This involves copying production environment files and running the deploy script. ```bash cd ui cp .env.production.example .env.production yarn deploy ``` -------------------------------- ### Setting UI Configuration via Data Attributes (Development) Source: https://github.com/getlantern/unbounded/blob/main/README.md Shows how to configure the UI widget by setting data-* attributes directly in the ui/public/index.html file. This method allows for static configuration within the HTML. ```html ``` -------------------------------- ### Setting UI Configuration via Environment Variables (Development) Source: https://github.com/getlantern/unbounded/blob/main/README.md Demonstrates how to customize UI settings during development using REACT_APP_* environment variables. These variables override default settings and can be set in a .env file or directly in the terminal. ```bash REACT_APP_LAYOUT=panel yarn start REACT_APP_MOCK=true yarn start ``` -------------------------------- ### Initialize Widget WASM and Broflake with JavaScript Source: https://github.com/getlantern/unbounded/blob/main/cmd/dist/public/index.html This snippet demonstrates how to load and run a WebAssembly module (widget.wasm) using JavaScript's WebAssembly API. It then initializes a 'newBroflake' instance, passing various configuration parameters such as network addresses and API endpoints. Dependencies include the Go.js runtime and the widget.wasm file. ```javascript const go = new Go(); WebAssembly.instantiateStreaming(fetch("widget.wasm"), go.importObject) .then((result) => { go.run(result.instance); newBroflake( "widget", 5, 5, 4096, "", "http://localhost:9000", "/v1/signal", 2, "", "http://localhost:8000", "/ws" ); }); ``` -------------------------------- ### Implement Custom UI Event Handlers (Go) Source: https://context7.com/getlantern/unbounded/llms.txt This Go code defines a custom UI handler by embedding the default `UIImpl` and overriding specific methods. It demonstrates how to implement callbacks for various UI events such as readiness, startup, downstream data chunks, throughput, and consumer connection changes. These callbacks allow for custom logic to be executed when these events occur. ```go package main import ( "net" "github.com/getlantern/broflake/clientcore" ) // Implement custom UI event handlers type MyUI struct { clientcore.UIImpl } func (u *MyUI) OnReady() { fmt.Println("Broflake is ready") } func (u *MyUI) OnStartup() { fmt.Println("Broflake started") } func (u *MyUI) OnDownstreamChunk(size int, workerIdx int) { fmt.Printf("Received %d bytes on worker %d\n", size, workerIdx) } func (u *MyUI) OnDownstreamThroughput(bytesPerSec int) { fmt.Printf("Throughput: %d bytes/sec\n", bytesPerSec) } func (u *MyUI) OnConsumerConnectionChange(state int, workerIdx int, addr net.IP) { if state == 1 { fmt.Printf("Consumer connected: %s on worker %d\n", addr, workerIdx) } else { fmt.Printf("Consumer disconnected from worker %d\n", workerIdx) } } // Configure connection change callbackfOpt := &clientcore.BroflakeOptions{ ClientType: "widget", OnConnectionChangeFunc: func(state int, workerIdx int, addr net.IP) { // state: 1 = connected, -1 = disconnected fmt.Printf("Connection change: state=%d worker=%d addr=%v\n", state, workerIdx, addr) }, } ``` -------------------------------- ### Create Egress WebSocket Listener (Go) Source: https://context7.com/getlantern/unbounded/llms.txt Creates a WebSocket listener for egress connections from volunteer widgets, providing internet access. It handles QUIC connection migration and requires a context, a TCP listener, and TLS configuration. ```go package main import ( "context" "crypto/tls" "net" "github.com/getlantern/broflake/egress" ) func main() { ctx := context.Background() // Create TCP listener ll, err := net.Listen("tcp", ":8000") if err != nil { panic(err) } // TLS config for QUIC layer tlsConfig := &tls.Config{ Certificates: []tls.Certificate{cert}, NextProtos: []string{"broflake"}, } // Create egress listener (serves WebSocket at /ws) listener, err := egress.NewListener(ctx, ll, tlsConfig) if err != nil { panic(err) } // Accept proxied connections from widgets for { conn, err := listener.Accept() if err != nil { continue } go handleConnection(conn) } } ``` -------------------------------- ### Create Broflake Client Instance (Go) Source: https://context7.com/getlantern/unbounded/llms.txt Initializes a new Broflake client instance with configurable options for WebRTC, egress servers, and client behavior. It returns a connection object and a UI interface for proxy control. Dependencies include the 'github.com/getlantern/broflake/clientcore' package. ```go package main import ( "github.com/getlantern/broflake/clientcore" "time" ) func main() { // Configure Broflake options bfOpt := &clientcore.BroflakeOptions{ ClientType: "desktop", // "desktop" for censored users, "widget" for volunteers CTableSize: 5, // Consumer table size (concurrent connections) PTableSize: 5, // Producer table size BusBufferSz: 4096, // IPC bus buffer size Netstated: "", // Optional netstate server URL for observability } // Configure WebRTC signaling options rtcOpt := &clientcore.WebRTCOptions{ DiscoverySrv: "https://freddie.example.com", Endpoint: "/v1/signal", GenesisAddr: "genesis", NATFailTimeout: 5 * time.Second, STUNBatchSize: 5, Patience: 500 * time.Millisecond, ErrorBackoff: 5 * time.Second, } // Configure egress server options (for widget clients) egOpt := &clientcore.EgressOptions{ Addr: "wss://egress.example.com", Endpoint: "/ws", ConnectTimeout: 5 * time.Second, ErrorBackoff: 5 * time.Second, } // Create the Broflake instance bfconn, ui, err := clientcore.NewBroflake(bfOpt, rtcOpt, egOpt) if err != nil { panic(err) } // Start the proxy ui.Start() // Use bfconn for proxied connections... // ui.Stop() to shutdown } ``` -------------------------------- ### Create Freddie Discovery Server (Go) Source: https://context7.com/getlantern/unbounded/llms.txt Creates a new Freddie instance for peer discovery, signaling, and matchmaking. It coordinates the WebRTC signaling handshake between users and proxies. This function requires a context and a listening address. ```go package main import ( "context" "github.com/getlantern/broflake/freddie" ) func main() { ctx := context.Background() // Create Freddie server listening on port 9000 f, err := freddie.New(ctx, ":9000") if err != nil { panic(err) } // Start HTTP server err = f.ListenAndServe() // Or with TLS: // err = f.ListenAndServeTLS("cert.pem", "key.pem") if err != nil { panic(err) } } ``` -------------------------------- ### Render Graph Visualization from Local Server (JavaScript) Source: https://github.com/getlantern/unbounded/blob/main/netstate/d/webclients/gv/public/index.html Fetches graph data from 'http://localhost:8080/neato', renders it as an SVG element using Viz.js, and appends it to the document body. Handles potential errors during the fetch or rendering process. Requires the Viz.js library to be loaded. ```javascript let viz = new Viz(); fetch("http://localhost:8080/neato") .then(response => response.text()) .then(text => viz.renderSVGElement(text)) .then(function(element) { document.body.appendChild(element); }) .catch(error => { viz = new Viz(); console.error(error); }); ``` -------------------------------- ### Create QUIC Transport Layer (Go) Source: https://context7.com/getlantern/unbounded/llms.txt Establishes a QUIC layer over an existing Broflake connection to enable reliable stream multiplexing. This allows multiple concurrent streams over an unreliable WebRTC datachannel transport. It requires a Broflake connection object and TLS configuration. ```go package main import ( "crypto/tls" "github.com/getlantern/broflake/clientcore" ) func setupQUICProxy(bfconn *clientcore.BroflakeConn, tlsConfig *tls.Config) error { // Create QUIC layer over Broflake connection ql, err := clientcore.NewQUICLayer(bfconn, tlsConfig) if err != nil { return err } // Start listening for QUIC connections in background go ql.ListenAndMaintainQUICConnection() // Create HTTP transport using QUIC layer httpTransport := clientcore.CreateHTTPTransport(ql) // Use httpTransport for HTTP requests over the P2P tunnel // httpTransport.Proxy, httpTransport.Dial, httpTransport.DialContext are configured return nil } ``` -------------------------------- ### Create SOCKS5 Proxy Dialer (Go) Source: https://context7.com/getlantern/unbounded/llms.txt Generates a SOCKS5-compatible dialer function that routes connections through the Broflake P2P tunnel. This dialer supports domain names, IPv4, and IPv6 addresses. It requires a QUIC layer instance and is used to configure a SOCKS5 server. ```go package main import ( "context" "github.com/armon/go-socks5" "github.com/getlantern/broflake/clientcore" ) func startSOCKS5Proxy(ql *clientcore.QUICLayer, addr string) error { // Create SOCKS5 dialer using QUIC layer dialer := clientcore.CreateSOCKS5Dialer(ql) // Configure SOCKS5 server with custom dialer conf := &socks5.Config{ Dial: dialer, } server, err := socks5.New(conf) if err != nil { return err } // Start SOCKS5 proxy on 127.0.0.1:1080 return server.ListenAndServe("tcp", "127.0.0.1:1080") } // Usage: Configure browser to use SOCKS5 proxy at 127.0.0.1:1080 // All traffic will be routed through the P2P tunnel ``` -------------------------------- ### Widget Connection Endpoint (Go) Source: https://context7.com/getlantern/unbounded/llms.txt Establishes a WebSocket connection from volunteer widgets to the egress server for egress tunnels. This Go function uses the websocket library and requires the egress address and a consumer session ID to build specific subprotocols for session management. ```go // Widget client connection example import ( "context" "github.com/coder/websocket" "github.com/getlantern/broflake/common" ) func connectToEgress(egressAddr, consumerSessionID string) (*websocket.Conn, error) { ctx := context.Background() // Build subprotocols for session identification subprotocols := common.NewSubprotocolsRequest(consumerSessionID, common.Version) conn, _, err := websocket.Dial(ctx, egressAddr+"/ws", &websocket.DialOptions{ Subprotocols: subprotocols, }) return conn, err } // Expected subprotocols: ["un80und3d", "", ""] ``` -------------------------------- ### Report Network State to Netstate Server (Go) Source: https://context7.com/getlantern/unbounded/llms.txt This Go function reports network topology state changes to the netstate observability server. It takes the netstated server URL, a list of connected consumers, and a tag as input. The function constructs an instruction with the consumer state operation and executes it using the netstate client library. ```go package main import ( "github.com/getlantern/broflake/netstate/client" ) func reportState(netstatedURL string, connectedConsumers [][]string, tag string) error { // connectedConsumers: [[IP, tag, workerIdx], [IP, tag, workerIdx], ...] inst := &netstatecl.Instruction{ Op: netstatecl.OpConsumerState, Args: netstatecl.EncodeArgsOpConsumerState(connectedConsumers), Tag: tag, } return netstatecl.Exec(netstatedURL, inst) } // Example usage connectedConsumers := [][]string{ {"192.168.1.100", "Alice", "0"}, {"192.168.1.101", "Bob", "1"}, } reportState("http://localhost:8080/exec", connectedConsumers, "MyWidget") ``` -------------------------------- ### Subscribe to Genesis Message Stream (Bash) Source: https://context7.com/getlantern/unbounded/llms.txt Consumers subscribe to receive genesis messages from producers. This command uses curl to connect to the signal endpoint and expects a streaming HTTP response with newline-delimited JSON messages. Requires the 'X-BF-Version' header. ```bash # Subscribe to genesis message stream curl -N -H "X-BF-Version: v2.1.6" \ "http://localhost:9000/v1/signal" # Response (streaming, newline-delimited): # {"ReplyTo":"abc123","Type":0,"Payload":"{\"PathAssertion\":{\"Allow\":[{\"Host\":\"*\",\"Distance\":1}]}}"} # {"ReplyTo":"def456","Type":0,"Payload":"{\"PathAssertion\":{\"Allow\":[{\"Host\":\"*\",\"Distance\":1}]}}"} ``` -------------------------------- ### UI Event Callbacks Source: https://context7.com/getlantern/unbounded/llms.txt The UI interface provides callbacks for monitoring proxy status and data throughput. Implement custom UI event handlers to receive real-time updates. ```APIDOC ## UI Event Callbacks ### Description Implement custom UI event handlers to receive callbacks for monitoring proxy status and data throughput. ### Method N/A (Callback functions) ### Endpoint N/A ### Parameters #### Request Body N/A ### Request Example N/A ### Response #### Success Response (N/A) Callbacks are invoked when specific events occur. - **OnReady()**: Called when the broflake client is ready. - **OnStartup()**: Called when the broflake client starts up. - **OnDownstreamChunk(size int, workerIdx int)**: Called when a chunk of data is received downstream. - **OnDownstreamThroughput(bytesPerSec int)**: Called with the current downstream throughput in bytes per second. - **OnConsumerConnectionChange(state int, workerIdx int, addr net.IP)**: Called when a consumer connection state changes (1 for connected, -1 for disconnected). #### Response Example N/A ``` -------------------------------- ### Handle Browser Messages and Storage Operations (JavaScript) Source: https://github.com/getlantern/unbounded/blob/main/ui/public/storage.html Listens for messages from a parent window, processes commands for storage retrieval and setting, and sends analytics events. It ensures messages are properly formatted and originate from the expected source. ```javascript var SIGNATURE = 'lanternNetwork'; window.addEventListener('message', function (event) { var message = event.data; if (typeof message !== 'object' || message === null || !message.hasOwnProperty(SIGNATURE)) return; switch (message.type) { case 'storageGet': window.parent.postMessage({ type: 'storageGet', [SIGNATURE]: true, data: { [message.data.key]: localStorage.getItem(message.data.key) } }, '*'); break; case 'storageSet': localStorage.setItem(message.data.key, message.data.value); break; case 'event': window.plausible(message.data.eventName, { props: message.data.eventProperties }); break; } }, false); ``` -------------------------------- ### Receive Network State Updates via HTTP POST (Bash) Source: https://context7.com/getlantern/unbounded/llms.txt This bash script demonstrates how to send network state updates to the netstated server using an HTTP POST request. It specifies the content type as JSON and includes the operation, arguments, and tag in the request body. This is used by the netstated server to receive state updates. ```bash # Report consumer state to netstated curl -X POST "http://localhost:8080/exec" \ -H "Content-Type: application/json" \ -d '{ "Op": 0, "Args": ["192.168.1.100,Alice,0", "192.168.1.101,Bob,1"], "Tag": "MyWidget" }' ``` -------------------------------- ### Send Signaling Message (Bash) Source: https://context7.com/getlantern/unbounded/llms.txt Sends a signaling message (offer, answer, or ICE candidates) to a specific peer. This curl command requires the 'send-to' parameter to identify the recipient and specifies the message type and data. The 'X-BF-Version' header is also required. ```bash # Send WebRTC offer to a producer curl -X POST "http://localhost:9000/v1/signal" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "X-BF-Version: v2.1.6" \ -d "send-to=abc123" \ -d "type=1" \ -d "data={\"SDP\":{\"type\":\"offer\",\"sdp\":\"v=0\\r\\n...\"},\"Tag\":\"user1\"}" # Response: 200 OK with answer SDP in body # {"ReplyTo":"xyz789","Type":2,"Payload":"{\"type\":\"answer\",\"sdp\":\"v=0\\r\\n...\"}"} # Send ICE candidates curl -X POST "http://localhost:9000/v1/signal" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "X-BF-Version: v2.1.6" \ -d "send-to=xyz789" \ -d "type=3" \ -d "data={\"Candidates\":[{\"foundation\":\"1\",\"priority\":2130706431,...}],\"ConsumerSessionID\":\"session123\"}" # Message types: 0=Genesis, 1=Offer, 2=Answer, 3=ICE ``` -------------------------------- ### Freddie Discovery Server API Source: https://context7.com/getlantern/unbounded/llms.txt APIs for the Freddie Discovery Server, which handles peer discovery, signaling, and matchmaking for censored users. ```APIDOC ## POST /v1/signal - Send Signaling Message ### Description Sends a signaling message (offer, answer, or ICE candidates) to a specific peer identified by the `send-to` parameter. ### Method POST ### Endpoint /v1/signal ### Parameters #### Query Parameters - **send-to** (string) - Required - The identifier of the peer to send the message to. - **type** (integer) - Required - The type of signaling message (0=Genesis, 1=Offer, 2=Answer, 3=ICE). - **data** (string) - Required - The signaling message payload, typically JSON encoded. ### Request Example ```bash curl -X POST "http://localhost:9000/v1/signal" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "X-BF-Version: v2.1.6" \ -d "send-to=abc123" \ -d "type=1" \ -d "data={"SDP":{"type":"offer","sdp":"v=0\r\n..."},"Tag":"user1"}" ``` ### Response #### Success Response (200) - **ReplyTo** (string) - The identifier for the reply. - **Type** (integer) - The type of message received. - **Payload** (string) - The signaling message payload, typically JSON encoded. #### Response Example ```json { "ReplyTo": "xyz789", "Type": 2, "Payload": "{"type":"answer","sdp":"v=0\r\n..."}" } ``` ``` ```APIDOC ## GET /v1/signal - Subscribe to Genesis Message Stream ### Description Consumers (censored users) subscribe to receive genesis messages from producers (volunteers). Returns a streaming HTTP response with newline-delimited JSON messages. ### Method GET ### Endpoint /v1/signal ### Parameters #### Headers - **X-BF-Version** (string) - Required - The version of the client. ### Request Example ```bash curl -N -H "X-BF-Version: v2.1.6" \ "http://localhost:9000/v1/signal" ``` ### Response #### Success Response (200) - **ReplyTo** (string) - The identifier for the reply. - **Type** (integer) - The type of message. - **Payload** (string) - The message payload, typically JSON encoded. #### Response Example ```json {"ReplyTo":"abc123","Type":0,"Payload":"{"PathAssertion":{"Allow":[{"Host":"*","Distance":1}]}}"} ``` ``` ```APIDOC ## GET /healthz - Health Check Endpoint ### Description Returns server health status and current request counts. ### Method GET ### Endpoint /healthz ### Parameters None ### Request Example ```bash curl "http://localhost:9000/healthz" ``` ### Response #### Success Response (200) - **Server Status** (string) - Health status message. - **Current Request Counts** (string) - Current counts for GET and POST requests. #### Response Example ``` freddie (v2.1.6) current GET requests: 5 current POST requests: 2 ``` ``` -------------------------------- ### Egress Server API Source: https://context7.com/getlantern/unbounded/llms.txt APIs for the Egress Server, which provides egress to the internet for volunteer widgets. ```APIDOC ## WebSocket /ws - Widget Connection Endpoint ### Description Volunteer widgets connect via WebSocket to establish egress tunnels. The connection includes subprotocol negotiation for session management. ### Method GET ### Endpoint /ws ### Parameters #### Query Parameters - **consumerSessionID** (string) - Required - The identifier for the consumer session. #### Headers - **Sec-WebSocket-Protocol** (string) - Required - Subprotocol negotiation string, typically in the format `["un80und3d", "", ""]`. ### Request Example ```go // Widget client connection example import ( "context" "github.com/coder/websocket" "github.com/getlantern/broflake/common" ) func connectToEgress(egressAddr, consumerSessionID string) (*websocket.Conn, error) { ctx := context.Background() // Build subprotocols for session identification subprotocols := common.NewSubprotocolsRequest(consumerSessionID, common.Version) conn, _, err := websocket.Dial(ctx, egressAddr+"/ws", &websocket.DialOptions{ Subprotocols: subprotocols, }) return conn, err } ``` ### Response #### Success Response (101) - Switching Protocols - **WebSocket Connection** - An established WebSocket connection. #### Response Example (No specific JSON response, but an established WebSocket connection is returned.) ``` -------------------------------- ### Embed HTML Widget with Data Attributes (HTML) Source: https://context7.com/getlantern/unbounded/llms.txt This HTML snippet shows how to embed the Unbounded volunteer widget into a webpage using a custom HTML element ``. It utilizes data attributes to configure various aspects of the widget's appearance and behavior, such as layout, theme, and the display of a WebGL globe. A script tag is required to load the widget's functionality. ```html ``` -------------------------------- ### HTML Widget Embedding Source: https://context7.com/getlantern/unbounded/llms.txt Embed the Unbounded volunteer widget in any webpage using the custom HTML element `` with configurable data attributes. ```APIDOC ## HTML Widget Embedding ### Description Embed the Unbounded volunteer widget in any webpage using the custom HTML element `` with configurable data attributes. ### Method N/A (HTML Element) ### Endpoint N/A ### Parameters #### HTML Attributes - **data-layout** (string) - Optional - "banner" or "panel" (default: banner). - **data-theme** (string) - Optional - "dark", "light", or "auto" (default: light). - **data-globe** (string) - Optional - "true" or "false" - WebGL globe visualization (default: true). - **data-exit** (string) - Optional - "true" or "false" - Exit intent toast (default: true). - **data-menu** (string) - Optional - "true" or "false" - Include menu (default: true). - **data-keep-text** (string) - Optional - "true" or "false" - Keep tab open text (default: true). - **data-branding** (string) - Optional - "true" or "false" - Show logos (default: true). - **data-mock** (string) - Optional - "true" or "false" - Use mock data (default: false). - **data-target** (string) - Optional - "web", "extension-offscreen", or "extension-popup" (default: web). ### Request Example ```html ``` ### Response N/A (Widget is rendered in the browser) ``` -------------------------------- ### POST /exec - Receive Network State Updates Source: https://context7.com/getlantern/unbounded/llms.txt The netstated server receives state updates via HTTP POST with a JSON payload. This endpoint is used to report network topology state changes to the netstate observability server. ```APIDOC ## POST /exec - Receive Network State Updates ### Description Reports network topology state changes to the netstate observability server for visualization and debugging. ### Method POST ### Endpoint /exec ### Parameters #### Request Body - **Op** (integer) - Required - Operation code. For consumer state, this should be 0. - **Args** (array of strings) - Required - Arguments for the operation. For consumer state, this should be a list of strings formatted as "IP,tag,workerIdx". - **Tag** (string) - Required - A tag to identify the source of the state update. ### Request Example ```json { "Op": 0, "Args": ["192.168.1.100,Alice,0", "192.168.1.101,Bob,1"], "Tag": "MyWidget" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the state was received. #### Response Example ```json { "message": "State received successfully" } ``` ``` -------------------------------- ### Health Check Endpoint (Bash) Source: https://context7.com/getlantern/unbounded/llms.txt Retrieves the server's health status and current request counts. This simple curl command targets the /healthz endpoint and returns server information and metrics. ```bash curl "http://localhost:9000/healthz" # Response: # freddie (v2.1.6) # current GET requests: 5 # current POST requests: 2 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.