normalize

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WS    = by("ws://")
	WSS   = by("wss://")
	HTTP  = by("http://")
	HTTPS = by("https://")
)
View Source
var (
	AuthRequired = Reason("auth-required")
	PoW          = Reason("pow")
	Duplicate    = Reason("duplicate")
	Blocked      = Reason("blocked")
	RateLimited  = Reason("rate-limited")
	Invalid      = Reason("invalid")
	Error        = Reason("error")
	Unsupported  = Reason("unsupported")
	Restricted   = Reason("restricted")
)

Functions

func Msg

func Msg(prefix Reason, format st, params ...any) by

Msg constructs a properly formatted message with a machine-readable prefix for OK and CLOSED envelopes.

func URL

func URL[V st | by](v V) (b by)

URL normalizes the URL

- Adds wss:// to addresses without a port, or with 443 that have no protocol prefix

- Adds ws:// to addresses with any other port

- Converts http/s to ws/s

Types

type Reason

type Reason by

func (Reason) B

func (r Reason) B() by

func (Reason) F

func (r Reason) F(format st, params ...any) by

func (Reason) IsPrefix

func (r Reason) IsPrefix(reason by) bo

func (Reason) S

func (r Reason) S() st

Jump to

Keyboard shortcuts

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