Skip to content

dmsgweb

Moses Narrow edited this page Apr 6, 2024 · 8 revisions

dmsgweb

Dmsgweb is an application which permits access to websites (public-key:port) over dmsg with a web browser via proxy configuration.

Dmsgweb is now available as skywire dmsg web

The idea for the dmsgweb implementation was inspired by that of i2p, which allows access to .i2p domains or websites in a similar manner via a proxy configuration in a web browser. Dmsgweb can be additionally configured with the proxy provided by i2p in order to access i2p websites as well as .dmsg websites. The TOR browser may also be configured with dmsgweb's resolving proxy, if desired, and if dmsgweb is configured with the i2p proxy in addition, it is possible to browse .onion, .dmsg, and .i2p domains at once, if desired.

Screenshot_2024-04-06_17-34-30

$ skywire dmsg web --help

	┌┬┐┌┬┐┌─┐┌─┐┬ ┬┌─┐┌┐
	 │││││└─┐│ ┬│││├┤ ├┴┐
	─┴┘┴ ┴└─┘└─┘└┴┘└─┘└─┘
DMSG resolving proxy & browser client - access websites over dmsg

Available Commands:
  gen-keys     generate public / secret keypair

Flags:
  -d, --dmsg-disc string   dmsg discovery url default:
                           http://dmsgd.skywire.skycoin.com
  -f, --filter string      domain suffix to filter (default ".dmsg")
  -l, --loglvl string      [ debug | warn | error | fatal | panic | trace | info ]
  -p, --port string        port to serve the web application (default "8080")
  -r, --proxy string       configure additional socks5 proxy for dmsgweb (i.e. 127.0.0.1:1080)
  -t, --resolve string     resolve the specified dmsg address:port on the local port & disable proxy
  -e, --sess int           number of dmsg servers to connect to (default 1)
  -s, --sk cipher.SecKey   a random key is generated if unspecified
 (default 0000000000000000000000000000000000000000000000000000000000000000)
  -q, --socks string       port to serve the socks5 proxy (default "4445")
  -v, --version            version for web

This application is very simple and has two main parts which are wrapped in a cobra cli framework to provide the help menu.

The application consists of

  • a resolving socks5 proxy which can be configured in a web browser (default http port 4445)
  • an http server which translates requests to and copies responses from a dmsg(http) client (default http port 8080).

Another socks5 proxy (i.e. the skywire socks5 proxy client - default socks5://127.0.0.1:1080) can be configured via the -r flag to force both the regular http traffic as well as the dmsg client connection to the dmsg network itself through another proxy. As mentioned above, it's also possible to configure the i2p proxy for dmsgweb.

Browse Dmsghttp websites

It is suggested to first create a keypair for the dmsg client to connect with. This step is optional, but recommended:

skywire dmsg web gen-keys > dmsgweb.key

If desired, configure a locally running skywire visor's proxy client for this application. refer to the socks5 proxy user guide article from this wiki for starting the proxy client.

After completing the above two steps, start dmsgweb like this:

skywire dmsg web -s $(tail -n1 dmsgweb.key) -r 127.0.0.1:1080

If you skipped the previous two steps, start dmsgweb without flags or arguments; and a keypair will be generated automatically:

skywire dmsg web

Note: it is not advisable to whitelist any public key used by dmsgweb without explicitly generating the keypair and saving to a file as detailed in the above steps.

To configure this application in a web browser, use SOCKS5 proxy 127.0.0.1:4445 (default in dmsgweb).

The process of configuring a proxy in different web browsers is described in the socks5 proxy user guide article. Simply change the port to 4445.

A few experimental dmsg websites exist, notably the skywire reward system frontend fiber.skywire.dev which can be accessed here:

http://036a70e6956061778e1883e928c1236189db14dfd446df23d83e45c321b330c91f.dmsg

fiber.skywire.dev/health will indicate the dmsg address it is running on.

The dmsghttp log server's /health endpoint may be accessed over dmsg for any skywire visor - if that visor is indeed connected to dmsg.

The custom dmsghttp path field in the visor's config specifies a custom path which is served by the visor over dmsghttp. This is by default a folder called "custom" inside the local_path or local folder of the skywire installation.

Any files added to the custom dmsghttp path may be accessed over dmsghttp.

If an index.html is added, a static website is readily possible for any running skywire visor and may be accessed by the visor's public key.

For advanced integration of dmsg with existing websites, see the dmsghttp article

Note on URL Scheme

While dmsgcurl and similar utilities use a custom URL scheme: dmsg://<pk>:<port>/ this is not supported by browsers.

To access websites over dmsg, use the following scheme:

http://<pk>.dmsg:<port>/

If the application uses the default dmsg port 80, the port can be omitted and the URL specified as follows

http://<pk>.dmsg/

Notes on Web Browser Compatibility

Web Browsers vary to some degree in their support for accessing .dmsg addresses which are entered directly in the URL / search bar.

It may be necessary to disable auto-https redirects in settings.

For Brave browser, no matter how the .dmsg URL is entered in the search bar, a search is performed. However, clicking the link to the reward system frontend here will permit access to the dmsg website(!):

http://036a70e6956061778e1883e928c1236189db14dfd446df23d83e45c321b330c91f.dmsg

There is no apparent way to disable this behavior, however, a workaround is to create an html document and include the link to the dmsg website which one desires to access.

Open the html document in the browser, and then click the link in the document to access the dmsg website.

Alternative Use Case

The -t, --resolve flag was added to dmsgweb to allow resolving a single dmsg pk:port locally via the web port (default 8080) without serving socks5 proxy.

dmsgweb -t 036a70e6956061778e1883e928c1236189db14dfd446df23d83e45c321b330c91f:80

the dmsg website at 036a70e6956061778e1883e928c1236189db14dfd446df23d83e45c321b330c91f:80 may now be accessed at http://127.0.0.1:8080

This may be used to avoid http traffic to a remote server, or avoid the use of http 301 / 302 redirects to another domain, or to avoid port forwarding.

Simply reverse proxy the http port where the remote dmsg website is served locally to your desired domain.

Advanced Use Cases

The dmsg client is persistent with dmsgweb ; whereas with dmsgcurl the client is started for and stopped after each task, currently. The time of the initial connection can be a significant factor in scripted operations ; hence it is advantageous to leverage the completeness of existing utilities such as curl or others, if you prefer, to do standard http requests using the resolving proxy provided by dmsgweb.

Example:

$ curl -Lx socks5h://127.0.0.1:4445 http://$(skywire cli visor pk).dmsg/health 
{"build_info":{"version":"v1.3.20","commit":"8e782b1","date":"2024-03-23T01:29:00Z"},"started_at":"2024-04-06T12:41:54.253875421-05:00"}
Clone this wiki locally