npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@f0x52/autodiscover-server-configuration

v1.1.4

Published

Auto-discovers Matrix server configuration for a given hostname (including eg. doing a .well-known lookup)

Downloads

16

Readme

@modular-matrix/autodiscover-server-configuration

forked from autodiscover-client-configuration which is what you need for client-server API discovery.

Automatically discovers the Matrix homeserver for a given hostname, according to the process described in the Server-Server API specification.

(not yet) part of the Modular Matrix toolkit, a set of modular libraries for working with the Matrix protocol.

Example

"use strict";

const Promise = require("bluebird");
const autodiscoverServerConfiguration = require("@f0x52/autodiscover-server-configuration");

return Promise.try(() => {
	return Promise.all([
		autodiscoverServerConfiguration.discover("pixie.town"),   // wellKnown
		autodiscoverServerConfiguration.discover("t2bot.io"),     // srvLookup
		autodiscoverServerConfiguration.discover("conduit.rs"), // wellKnownPort8448
		autodiscoverServerConfiguration.discover("maunium.net"), // srvLookup, has delegatedHostname
	]);
}).then((data) => {
	console.log(data);
	/*
	[
		{
			method: 'wellKnown',
			homeserver: 'https://pixie.town:443',
			raw: { 'm.server': 'pixie.town:443' }
		},
		{
			method: 'srvLookup',
			homeserver: 'https://synapse.02.fsn1.ht.t2host.io:443',
			raw: {
	  			name: 'synapse.02.fsn1.ht.t2host.io',
	  			port: 443,
	  			priority: 10,
	  			weight: 0
			}
		},
		{
			method: 'wellKnownPort8448',
			homeserver: 'https://conduit.koesters.xyz:8448',
			raw: { 'm.server': 'conduit.koesters.xyz' }
		},
		{
			method: 'srvLookup',
			homeserver: 'https://meow.host.mau.fi:443',
			raw: { name: 'meow.host.mau.fi', port: 443, priority: 10, weight: 10 },
			delegatedHostname: 'federation.mau.chat'
		}
	]
	*/
}).catch(autodiscoverServerConfiguration.LookupFailed, (error) => {
	console.error(error.message);
});

API

autodiscoverClientConfiguration.discover(hostname)

Attempt to determine the homeserver associated with the specified hostname.

  • hostname: The hostname to apply autodiscovery for. This may be either an explicitly-specified hostname (port optional) (not a URL!), IP literal, IP literal with port, or the server name extracted from a Matrix ID.

If no homeserver could be discovered, the returned Promise rejects with an autodiscoverServerConfiguration.LookupFailed error.

If the autodiscovery was successful, it will resolve with an object with the following structure:

  • method: The method by which the homeserver information was determined. Currently one of wellKnown (server + port from a .well-known/matrix/server file), wellKnownPort8448 (using the server from the wellKnown response guessing port 8448), or srvLookup finding a server through the _matrix._tcp SRV record(s).
  • homeserver: The base URL of the autodiscovered homeserver.
  • delegatedHostname: delegated_hostname of the autodiscovered homeserver, if available MUST be sent as the Host: header with every request
  • raw: The method-specific raw data that was used for autodiscovery. You don't need this unless you need to read out custom keys.
    • For wellKnown/wellKnownPort8448 results, this data is the parsed response of .well-known/matrix/server.
    • For srvLookup results, this data is the _matrix._tcp SRV record with the lowest priority.

autodiscoverServerConfiguration.LookupFailed

An error type that signifies that this library could not determine a homeserver URL for the specified hostname.

This error type correctly inherits from Error, and can be used with instanceof and utilities that use it, such as Bluebird's filtered .catch.

Changelog

1.1.4 (September 5th, 2021)

  • Catch SSL altname invalid errors in WellKnown lookup

1.1.3 (🏳️‍🌈 June 18th, 2021)

  • return cert fail error instead of throwing

1.1.2 (🏳️‍🌈 June 18th, 2021)

  • remove debug console.log

1.1.1 (🏳️‍🌈 June 18th, 2021)

  • server TLS certificate errors are now caught in server checks

1.1.0 (🏳️‍🌈 June 17th, 2021)

  • add delegatedHostname for servers that have .well-known + SRV

1.0.3 (🏳️‍🌈 June 17th, 2021)

  • add proper checkServerIdentity https agent for SRV records

1.0.2 (🏳️‍🌈 June 17th, 2021)

  • Upgrade dependencies

1.0.1 (🏳️‍🌈 June 17th, 2021)

  • Patch error handling for failed SRV lookups
  • Patch url formatting with ports

1.0.0 (May 27th, 2021)

Forked from autodiscover-client-configuration, initial release.