syncthing/lib/api
wouter bolsterlee 25151b14e7
lib/api: Treat *.localhost as valid localhost addresses (#7412) (ref #4815)
This loosens the ‘is this localhost?’ check to include *.localhost host
names.

This allows for clearer (hence better) names to be used in browsers,
e.g. when accessing a remote syncthing instance ‘foo’ using a ssh port
forward, one can use foo.localhost to remind oneself which one is which.
💡 Without these changes, Syncthing shows a ‘Host check error’ when
pointing a browser at http://foo.localhost/, and with these changes, the
interface loads as usual.

The .localhost top level domain is a reserved top-level domain (RFC 2606):

> The ".localhost" TLD has traditionally been statically defined in
> host DNS implementations as having an A record pointing to the
> loop back IP address and is reserved for such use.  Any other use
> would conflict with widely deployed code which assumes this use.
> – https://tools.ietf.org/html/rfc2606

As Wikipedia puts it:

> This allows the use of these names for either documentation purposes
or in local testing scenarios. – https://en.wikipedia.org/wiki/.localhost

On Linux systems, systemd-resolved resolves *.localhost, on purpose:
https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html

See also #4815, #4816.
2021-02-27 08:52:49 +01:00
..
auto lib/assets: Allow assets to remain uncompressed (#6661) 2020-05-25 08:51:27 +02:00
testdata cmd/syncthing, lib/api: Separate api/gui into own package (ref #4085) (#5529) 2019-03-26 19:53:58 +00:00
.gitignore lib/api: Ignore that one file that always shows up in git status 2020-03-07 11:46:54 +01:00
api_auth_test.go lib/api: Refactor to run tests in parallel (#5998) 2019-09-05 12:35:51 +01:00
api_auth.go lib/api: Add LDAP search filters (fixes #5376) (#6488) 2020-04-04 11:33:43 +02:00
api_csrf.go lib/api: Refactor to run tests in parallel (#5998) 2019-09-05 12:35:51 +01:00
api_statics.go all: Add untrusted folders behind feature flag (ref #62) (#7055) 2020-11-09 15:33:32 +01:00
api_test.go lib/api: Treat *.localhost as valid localhost addresses (#7412) (ref #4815) 2021-02-27 08:52:49 +01:00
api.go lib/api: Treat *.localhost as valid localhost addresses (#7412) (ref #4815) 2021-02-27 08:52:49 +01:00
confighandler.go all: Add configurable defaults (fixes #4224, fixes #6086) (#7131) 2021-02-04 21:10:41 +01:00
debug.go all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
mocked_config_test.go all: Add configurable defaults (fixes #4224, fixes #6086) (#7131) 2021-02-04 21:10:41 +01:00
mocked_connections_test.go all: Implement suture v4-api (#6947) 2020-11-17 13:19:04 +01:00
mocked_discovery_test.go all: Implement suture v4-api (#6947) 2020-11-17 13:19:04 +01:00
mocked_events_test.go lib/api, lib/model: Fixes around event request tracking (#6774) 2020-06-25 21:48:48 +02:00
mocked_logger_test.go cmd/syncthing, lib/api: Separate api/gui into own package (ref #4085) (#5529) 2019-03-26 19:53:58 +00:00
mocked_model_test.go lib/versioner: Improve error messages (fixes #7354) (#7357) 2021-02-12 20:30:51 +01:00
support_bundle.go cmd/syncthing, lib/api: Separate api/gui into own package (ref #4085) (#5529) 2019-03-26 19:53:58 +00:00