Standard library / net

net.IPMask

Byte-slice mask; CIDRMask constructs contiguous masks. Expected stdout: '4\n'.

Formal Syntax & Structure

go syntaxgo
type IPMask []byte

Working Example

Example Snippetgo
package main
import (  "fmt"  "net")
func main() { v := net.CIDRMask(24, 32); fmt.Println(len(v)) }
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