ipv6host

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ipv6host writes IPv6 hosts in the one form browsers serialize them in, so that every spelling of an address (RFC 4291 Section 2.2) compares equal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(host string) string

Canonical rewrites the bracketed IPv6 address that host starts with, as in "[0:0:0:0:0:0:0:1]:3000", and returns anything else unchanged.

func Parse

func Parse(s string) (netip.Addr, bool)

Parse parses an IPv6 address written without brackets. A zone is refused: netip copies it, and Unmap would drop it.

func String

func String(addr netip.Addr, raw string) string

String writes addr as the WHATWG URL serializer does: RFC 5952 Section 4, and an IPv4-mapped tail in hex ("::ffff:7f00:1"). raw is returned when it already is that form, so the common case does not allocate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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