relayurl

package
v0.6.0-rc3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package relayurl applies NIP-42-flavored URL normalization for the purpose of comparing a client-supplied AUTH `relay` tag against the relay's configured Auth.RelayURL. NIP-42 says: "URL normalization techniques can be applied. For most cases just checking if the domain name is correct should be enough."

We canonicalize scheme + host (lowercase), strip default ports (443 for wss/https, 80 for ws/http), and strip a single trailing slash from the path. We don't go all the way to "domain only" so a relay running on a non-standard path or shared host can't accept AUTH addressed elsewhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(s string) string

Canonical returns a normalized form of s suitable for equality comparison. If s fails to parse as a URL we fall back to a case-insensitive trailing-slash-trimmed string so a malformed config doesn't permanently break auth.

func Match

func Match(got, want string) bool

Match reports whether two relay URLs refer to the same relay after canonicalization.

Types

This section is empty.

Jump to

Keyboard shortcuts

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