schemehost

package
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package schemehost maps URLs of the app's custom schemes to the http://*.localhost URLs that serve them where the webview can't load a custom scheme itself (WebView2), and back.

<scheme>://localhost/… is served at http://<scheme>.localhost/…, and <scheme>://<host>/… at http://<host>.<scheme>.localhost/…. Chromium treats every *.localhost host as a secure origin on the loopback interface, so each host stays its own origin, as with the custom schemes of the other webviews.

Hosts are names of DNS labels (letters, digits and hyphens, at most 63 each, not starting or ending with a hyphen) separated by dots, as Chromium needs them in an http URL. They are lower-cased: hosts are case-insensitive, and the webview reports them in lower case. URLs with another host, a port, user info or no host aren't mapped, so the webview loads them as they are.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppHost

func AppHost(webHost string, has func(scheme string) bool) (scheme, host string, ok bool)

AppHost splits webHost, the host of an http URL, into the scheme and host of the app's URL it serves: <scheme>.localhost is <scheme>://localhost, and <host>.<scheme>.localhost is <scheme>://<host>. The longest scheme that has reports wins.

func AppOrigin

func AppOrigin(origin string, has func(scheme string) bool) string

AppOrigin maps origin, the origin of a page that an http URL serving a scheme of the app loaded, back to the origin of that scheme, such as http://abc.myapp.localhost to myapp://abc. Other origins are returned as they are.

func AppURL

func AppURL(raw string, has func(scheme string) bool) string

AppURL maps raw, an http URL that serves a scheme that has reports as the app's, back to the URL of that scheme. Other URLs are returned as they are.

func WebURL

func WebURL(raw string, has func(scheme string) bool) string

WebURL maps raw, a URL of a scheme that has reports as the app's, to the http URL that serves it. Other URLs are returned as they are.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL