Standard library / net

net.IPNet

Network address and mask; use Contains for membership. Expected stdout: '192.0.2.0\n'.

Formal Syntax & Structure

go syntaxgo
type IPNet struct {  IP   IP  Mask IPMask}

Working Example

Example Snippetgo
package main
import (  "fmt"  "net")
func main() { _, v, e := net.ParseCIDR("192.0.2.0/24"); check(e); fmt.Println(v.IP) }
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