Standard library / net

net.IPNet.Network()

Return the address network type, not a transport protocol. Expected stdout: 'ip+net\n'.

Formal Syntax & Structure

go syntaxgo
func (n *IPNet) Network() string

Return Value

string

Operation result; check errors and validity indicators when returned.

Working Example

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