diff options
| author | Bartosz Janda <bartosz.janda@gmail.com> | 2022-03-20 12:51:39 +0100 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2022-05-06 22:50:29 -0400 |
| commit | c3609dd368a2af1a40005eacfbddc40f210b302f (patch) | |
| tree | 1a751857b5932a65fe733ee781c5ac391317d2c6 /docs-src/content | |
| parent | 4b831845fb808158ca0861644dc632c22f022525 (diff) | |
Removed `net.StdParse*` methods. Add support for `net/netip.Prefix` type parsing. Convert return types to use `inet.af/netaddr` types.
Diffstat (limited to 'docs-src/content')
| -rw-r--r-- | docs-src/content/functions/net.yml | 47 |
1 files changed, 4 insertions, 43 deletions
diff --git a/docs-src/content/functions/net.yml b/docs-src/content/functions/net.yml index c9f387d0..bc24f62b 100644 --- a/docs-src/content/functions/net.yml +++ b/docs-src/content/functions/net.yml @@ -193,45 +193,6 @@ funcs: $ gomplate -i '{{ $range := net.ParseIPRange "1.2.3.0-1.2.3.233" -}} {{ $range.Prefixes }}' [1.2.3.0/25 1.2.3.128/26 1.2.3.192/27] - - name: net.StdParseIP - description: | - Parse the given string as an IP address (a `net.IP` from the - [`net`][] package). - - Any of `net.IP`'s methods may be called on the resulting value. See - [the docs](https://pkg.go.dev/net) for details. - pipeline: true - arguments: - - name: ip - required: true - description: The IP string to parse. It must be either an IPv4 or IPv6 address. - examples: - - | - $ gomplate -i '{{ net.StdParseIP "192.168.0.1" }}' - 192.168.0.1 - $ gomplate -i '{{ $ip := net.StdParseIP (net.LookupIP "example.com") -}} - {{ $ip }}' - 93.184.216.34 - - name: net.StdParseCIDR - description: | - Parse the given string as an IP address prefix (CIDR) representing an IP - network (a `net.ParseCIDR` from the - [`net`][] package). - - The string can be in the form `"192.168.1.0/24"` or `"2001::db8::/32"`, - the CIDR notations defined in [RFC 4632][] and [RFC 4291][]. - - Any of `net.IP`'s methods may be called on the resulting value. See - [the docs](https://pkg.go.dev/net) for details. - pipeline: true - arguments: - - name: prefix - required: true - description: The IP address prefix to parse. It must represent either an IPv4 or IPv6 prefix, containing a `/`. - examples: - - | - $ gomplate -i '{{ net.StdParseCIDR "192.168.0.123/24" }}' - 192.168.0.0/24 - name: net.CidrHost description: | Calculates a full host IP address for a given host number within a given IP network address prefix. @@ -248,7 +209,7 @@ funcs: description: Is a whole number that can be represented as a binary integer with no more than the number of digits remaining in the address after the given prefix. - name: prefix required: true - description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.StdParseCIDR` can by used. + description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.ParseIPPrefix` can by used. examples: - | $ gomplate -i '{{ "10.12.127.0/20" | net.CidrHost 268 }}' @@ -263,7 +224,7 @@ funcs: arguments: - name: prefix required: true - description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.StdParseCIDR` can by used. + description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.ParseIPPrefix` can by used. examples: - | $ gomplate -i '{{ net.CidrNetmask "10.12.127.0/20" }}' @@ -281,7 +242,7 @@ funcs: description: Is the number of additional bits with which to extend the prefix. For example, if given a prefix ending in `/16` and a `newbits` value of `4`, the resulting subnet address will have length `/20`. - name: prefix required: true - description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.StdParseCIDR` can by used. + description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.ParseIPPrefix` can by used. examples: - | $ gomplate -i '{{ index ("10.0.0.0/16" | net.CidrSubnets 2) 1 }}' @@ -301,7 +262,7 @@ funcs: description: Numbers of additional network prefix bits for returned address range. - name: prefix required: true - description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.StdParseCIDR` can by used. + description: Must be given in CIDR notation. It must represent either an IPv4 or IPv6 prefix, containing a `/`. String or [`net.IPNet`](https://pkg.go.dev/net#IPNet) object returned from `net.ParseIPPrefix` can by used. examples: - | $ gomplate -i '{{ net.CidrSubnetSizes 4 4 8 4 "10.1.0.0/16" -}}' |
