Standard library / net/netip

netip.AddrFrom16()

Build an IPv6 value from sixteen octets; mapped addresses remain IPv6. Expected stdout: '::1\n'.

Formal Syntax & Structure

go syntaxgo
func AddrFrom16(addr [16]byte) Addr

Parameters & Attributes

NameTypeDescription
addr[16]byteAddress value or address bytes in the required representation.

Return Value

Addr

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/netip")
func main() { fmt.Println(netip.AddrFrom16([16]byte{15: 1})) }
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference