Skip to content

Go code, scripts and utilities for the Replica project.

Notifications You must be signed in to change notification settings

getlantern/replica

Folders and files

NameName
Last commit message
Last commit date
Feb 10, 2025
May 23, 2023
Feb 17, 2024
May 23, 2023
Mar 14, 2022
Apr 25, 2022
Feb 10, 2025
Sep 9, 2022
Mar 14, 2022
Apr 3, 2023
Sep 28, 2022
Feb 10, 2025
Feb 10, 2025
Apr 14, 2022
Dec 7, 2022
May 23, 2023

Repository files navigation

See the docs at https://github.com/getlantern/replica-docs

FAQ

Search Index Roundtrippers (i.e., how your Replica search query gets fetched)

Replica on the client-side (desktop, Android, etc.) uses two search indices:

  • Either a replica-rust instance somewhere remote (e.g., the one at https://replica-search-aws.lantern.io. See here for a complete breakdown).
    • We'll call this the primary search index
  • Or, a local "backup" instance living on the user's device, fetched from the DHT
    • See here for more info
    • We'll call this the local search index

When a search query occurs, ./server/dualsearchroundtripper.go:DualSearchIndexRoundTripper (which implements http.RoundTripper) runs the same request in parallel on both indices (i.e., it multipaths the request) and favours always the primary index (for fresher results). See that file for more info.

To be clear, here's the full search code flow:

  • ./server/server.go:NewHTTPHandler() creates a new local HTTP server.

    • Clients like lantern-android and lantern-desktop will create this so that the UI can talk to Go code through HTTP
  • A client runs a request like http://localhost:whateverport/search?s=bunnyfoofoo

  • The request gets routed to searchProxy.ServeHTTP

    • Which strips the prefix route here
    • And continues with the handling here
    • And as you see here, it uses DualSearchIndexRoundTripper to run the search query in parallel through both the primary and local search indices

About

Go code, scripts and utilities for the Replica project.

Resources

Stars

Watchers

Forks

Packages

No packages published