normalize

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WS    = B("ws://")
	WSS   = B("wss://")
	HTTP  = B("http://")
	HTTPS = B("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

This section is empty.

Types

type B

type B = []byte

func Msg

func Msg(prefix Reason, format S, params ...any) B

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

func URL

func URL[V S | B](v V) (b B)

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

type Ctx

type Ctx = context.T

type E

type E = error

type N

type N = int

type Reason

type Reason B

func (Reason) B

func (r Reason) B() B

func (Reason) F

func (r Reason) F(format S, params ...any) B

func (Reason) IsPrefix

func (r Reason) IsPrefix(reason B) bool

func (Reason) S

func (r Reason) S() S

type S

type S = string

Jump to

Keyboard shortcuts

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