58556d7281
ADDED: * netx.IsPub * encodingx/hexx Rest are mostly small corrections and docs
7797 lines
149 KiB
Markdown
7797 lines
149 KiB
Markdown
<div id="header">
|
||
|
||
# SprigX
|
||
|
||
<div class="details">
|
||
|
||
<span id="author" class="author">Brent Saner</span>
|
||
<span id="email" class="email"><bts@square-r00t.net></span>
|
||
<span id="revdate">Last rendered 2026-06-22 18:51:29 -0400</span>
|
||
|
||
</div>
|
||
|
||
<div id="toc" class="toc2">
|
||
|
||
<div id="toctitle">
|
||
|
||
Table of Contents
|
||
|
||
</div>
|
||
|
||
- [1. What is SprigX?](#wat)
|
||
- [2. How do I Render These Docs?](#rndr)
|
||
- [2.1. HTML](#rndr_html)
|
||
- [2.2. PDF](#rndr_pdf)
|
||
- [3. How do I Use SprigX?](#use)
|
||
- [4. Library Functions](#lib)
|
||
- [4.1. `CombinedFuncMap`](#lib_cmbfmap)
|
||
- [4.2. `CombinedHtmlFuncMap`](#lib_cmbhfmap)
|
||
- [4.3. `CombinedTxtFuncMap`](#lib_cmbtfmap)
|
||
- [4.4. `FuncMap`](#lib_fmap)
|
||
- [4.5. `HtmlFuncMap`](#lib_hfmap)
|
||
- [4.6. `Nop`](#lib_nop)
|
||
- [4.7. `TxtFuncMap`](#lib_tfmap)
|
||
- [5. Template Functions](#fn)
|
||
- [5.1. Debugging](#fn_dbg)
|
||
- [5.1.1. `dump`](#fn_dbg_dump)
|
||
- [5.2. "Meta"/Template Helpers](#fn_meta)
|
||
- [5.2.1. `metaIsNil`](#fn_meta_isnil)
|
||
- [5.2.2. `net`](#fn_net)
|
||
- [5.2.2.1. `netCidrMask`](#fn_net_cidrmask)
|
||
- [5.2.2.2. `netExtractAddr`](#fn_net_cidra)
|
||
- [5.2.2.3. `netExtractHost`](#fn_net_hph)
|
||
- [5.2.2.4. `netExtractIpnet`](#fn_net_cidrn)
|
||
- [5.2.2.5. `netExtractPort`](#fn_net_hpp)
|
||
- [5.2.2.6. `netIfaces`](#fn_net_ifaces)
|
||
- [5.2.2.7. `netIp4Mask`](#fn_net_ip4mask)
|
||
- [5.2.2.8. `netJoinHostPort`](#fn_net_jhp)
|
||
- [5.2.2.9. `netParseIP`](#fn_net_parseip)
|
||
- [5.2.3. `net/netip`](#fn_netip)
|
||
- [5.2.3.1. `netipAddrPort`](#fn_netip_addrport)
|
||
- [5.2.3.2. `netipParseAddr`](#fn_netip_parseaddr)
|
||
- [5.2.3.3. `netipParseAddrPort`](#fn_netip_pap)
|
||
- [5.2.3.4. `netipParsePrefix`](#fn_netip_parsepfx)
|
||
- [5.2.3.5. `netipPrefix`](#fn_netip_pfx)
|
||
- [5.2.4. `go4.org/netipx`](#fn_netipx)
|
||
- [5.2.4.1. `netipxAddrIpNet`](#fn_netipx_addripnet)
|
||
- [5.2.4.2. `netipxCmpPfx`](#fn_netipx_cmppfx)
|
||
- [5.2.4.3. `netipxFromStdAddr`](#fn_netipx_fromstdaddr)
|
||
- [5.2.4.4. `netipxFromIp`](#fn_netipx_fromip)
|
||
- [5.2.4.5. `netipxFromIpNet`](#fn_netipx_fromipnet)
|
||
- [5.2.4.6. `netipxParseRange`](#fn_netipx_parserange)
|
||
- [5.2.4.7. `netipxPfxAddr`](#fn_netipx_pfxaddr)
|
||
- [5.2.4.8. `netipxPfxIpNet`](#fn_netipx_pfxipnet)
|
||
- [5.2.4.9. `netipxPfxLast`](#fn_netipx_pfxlast)
|
||
- [5.2.4.10. `netipxPfxRange`](#fn_netipx_pfxrange)
|
||
- [5.2.4.11. `netipxRange`](#fn_netipx_range)
|
||
- [5.2.5. `r00t2.io/goutils/netx`](#fn_netx)
|
||
- [5.2.5.1. `netxAddrRfc`](#fn_netx_addrrfc)
|
||
- [5.2.5.2. `netxAddrRfc`](#fn_netx_cidr4ipmask)
|
||
- [5.2.5.3. `netxCidr4Mask`](#fn_netx_cidr4mask)
|
||
- [5.2.5.4. `netxCidr4Str`](#fn_netx_cidr4str)
|
||
- [5.2.5.5. `netxFamilyVer`](#fn_netx_familyver)
|
||
- [5.2.5.6. `netxGetAddrFam`](#fn_netx_getaddrfam)
|
||
- [5.2.5.7. `netxGetIpFam`](#fn_netx_getipfam)
|
||
- [5.2.5.8. `netxIpRfc`](#fn_netx_iprfc)
|
||
- [5.2.5.9. `netxIpRfcStr`](#fn_netx_iprfcstr)
|
||
- [5.2.5.10. `netxIpStripRfc`](#fn_netx_ipstriprfc)
|
||
- [5.2.5.11. `netxIp4MaskCidr`](#fn_netx_ip4maskcidr)
|
||
- [5.2.5.12. `netxIp4MaskMask`](#fn_netx_ip4maskmask)
|
||
- [5.2.5.13. `netxIp4MaskStr`](#fn_netx_ip4maskstr)
|
||
- [5.2.5.14. `netxIpVerStr`](#fn_netx_ipverstr)
|
||
- [5.2.5.15. `netxIsBrktd6`](#fn_netx_isbrktd6)
|
||
- [5.2.5.16. `netxIsIp`](#fn_netx_isip)
|
||
- [5.2.5.17. `netxIsPfx`](#fn_netx_ispfx)
|
||
- [5.2.5.18. `netxMask4Cidr`](#fn_netx_mask4cidr)
|
||
- [5.2.5.19. `netxMask4StrCidr`](#fn_netx_mask4Strcidr)
|
||
- [5.2.5.20. `netxMask4StrIpMask`](#fn_netx_mask4stripmask)
|
||
- [5.2.5.21. `netxMask4StrMask`](#fn_netx_mask4strmask)
|
||
- [5.2.5.22. `netxVerFamily`](#fn_netx_ver2fam)
|
||
- [5.2.6. `r00t2.io/goutils/netx/dnsx`](#fn_dnsx)
|
||
- [5.2.6.1. `dnsxPtrAddr`](#fn_dnsx_ptraddr)
|
||
- [5.2.6.2. `dnsxAddrPtr`](#fn_dnsx_addrptr)
|
||
- [5.2.6.3. `dnsxStrWire`](#fn_dnsx_str2wire)
|
||
- [5.2.6.4. `dnsxWireStr`](#fn_dnsx_wire2str)
|
||
- [5.2.6.5. `dnsxPtrIp`](#fn_dnsx_ptrip)
|
||
- [5.2.6.6. `dnsxIpPtr`](#fn_dnsx_ipptr)
|
||
- [5.2.6.7. `dnsxIsFqdn`](#fn_dnsx_isfqdn)
|
||
- [5.2.6.8. `dnsxIsTxt`](#fn_dnsx_istxt)
|
||
- [5.2.6.9. `dnsxIsNsec3`](#fn_dnsx_isnsec3)
|
||
- [5.2.6.10. `dnsxIsSrv`](#fn_dnsx_issrv)
|
||
- [5.2.6.11. `dnsxIsWild`](#fn_dnsx_iswild)
|
||
- [5.2.6.12. `dnsxIsLbl`](#fn_dnsx_islbl)
|
||
- [5.2.6.13. `dnsxIsPtr`](#fn_dnsx_isptr)
|
||
- [5.3. Numbers/Math](#fn_num)
|
||
- [5.3.1. `numFloat32Str`](#fn_num_f32s)
|
||
- [5.3.2. `numFloat64`](#fn_num_f64)
|
||
- [5.3.3. `numFloat64Str`](#fn_num_f64s)
|
||
- [5.3.4. `numFloatStr`](#fn_num_fs)
|
||
- [5.4. Operating System](#fn_os)
|
||
- [5.4.1. `osFQDN`](#fn_os_fqdn)
|
||
- [5.4.2. `osGroupById`](#fn_os_grpid)
|
||
- [5.4.3. `osGroupByName`](#fn_os_grpnm)
|
||
- [5.4.4. `osHost`](#fn_os_hst)
|
||
- [5.4.5. `osHostname`](#fn_os_hstnm)
|
||
- [5.4.6. `osIdState`](#fn_os_idst)
|
||
- [5.4.7. `osUser`](#fn_os_usr)
|
||
- [5.4.8. `osUserById`](#fn_os_usrid)
|
||
- [5.4.9. `osUserByName`](#fn_os_usrnm)
|
||
- [5.5. Paths](#fn_path)
|
||
- [5.5.1. Generic](#fn_path_gnrc)
|
||
- [5.5.1.1. `pathJoin`](#fn_path_gnrc_pj)
|
||
- [5.5.1.2. `pathPipeJoin`](#fn_path_gnrc_ppj)
|
||
- [5.5.1.3. `pathSliceJoin`](#fn_path_gnrc_psj)
|
||
- [5.5.1.4. `pathSlicePipeJoin`](#fn_path_gnrc_pspj)
|
||
- [5.5.1.5. `pathSubJoin`](#fn_path_gnrc_psubj)
|
||
- [5.5.2. OS/Platform-Tailored](#fn_path_os)
|
||
- [5.5.2.1. `osPathJoin`](#fn_path_os_pj)
|
||
- [5.5.2.2. `osPathPipeJoin`](#fn_path_os_ppj)
|
||
- [5.5.2.3. `osPathSep`](#fn_path_ossep)
|
||
- [5.5.2.4. `osPathSliceJoin`](#fn_path_os_psj)
|
||
- [5.5.2.5. `osPathSlicePipeJoin`](#fn_path_os_pspj)
|
||
- [5.5.2.6. `osPathSubJoin`](#fn_path_os_psubj)
|
||
- [5.6. PSUtil](#fn_ps)
|
||
- [5.6.1. CPU/Processor](#fn_ps_cpu)
|
||
- [5.6.1.1. `psCpuCnts`](#fn_ps_cpu_cnts)
|
||
- [5.6.1.2. `psCpuInfo`](#fn_ps_cpu_info)
|
||
- [5.6.1.3. `psCpuPct`](#fn_ps_cpu_pct)
|
||
- [5.6.1.4. `psCpuTimes`](#fn_ps_cpu_tms)
|
||
- [5.6.2. Disk](#fn_ps_dsk)
|
||
- [5.6.2.1. `psDiskIoCnts`](#fn_ps_dsk_iocnts)
|
||
- [5.6.2.2. `psDiskLabel`](#fn_ps_dsk_lbl)
|
||
- [5.6.2.3. `psDiskParts`](#fn_ps_dsk_parts)
|
||
- [5.6.2.4. `psDiskSerial`](#fn_ps_dsk_srl)
|
||
- [5.6.2.5. `psDiskUsage`](#fn_ps_dsk_usg)
|
||
- [5.6.3. Host](#fn_ps_hst)
|
||
- [5.6.3.1. `psHostBoot`](#fn_ps_hst_boot)
|
||
- [5.6.3.2. `psHostId`](#fn_ps_hst_id)
|
||
- [5.6.3.3. `psHostInfo`](#fn_ps_hst_info)
|
||
- [5.6.3.4. `psHostKernArch`](#fn_ps_hst_krnarch)
|
||
- [5.6.3.5. `psHostKernVer`](#fn_ps_hst_krnver)
|
||
- [5.6.3.6. `psHostPlatInfo`](#fn_ps_hst_plat)
|
||
- [5.6.3.7. `psHostPlatUptime`](#fn_ps_hst_uptm)
|
||
- [5.6.3.8. `psHostUsers`](#fn_ps_hst_usrs)
|
||
- [5.6.3.9. `psHostPlatVirt`](#fn_ps_hst_virt)
|
||
- [5.6.4. Load](#fn_ps_ld)
|
||
- [5.6.4.1. `psLoadAvg`](#fn_ps_ld_avg)
|
||
- [5.6.4.2. `psLoadMisc`](#fn_ps_ld_misc)
|
||
- [5.6.5. Memory](#fn_ps_mem)
|
||
- [5.6.5.1. `psMemExVMem`](#fn_ps_mem_exvmem)
|
||
- [5.6.5.2. `psMemSwap`](#fn_ps_mem_swap)
|
||
- [5.6.5.3. `psMemSwapDevs`](#fn_ps_mem_swapdevs)
|
||
- [5.6.5.4. `psMemVMem`](#fn_ps_mem_vmem)
|
||
- [5.6.6. Network](#fn_ps_net)
|
||
- [5.6.6.1. `psNetConns`](#fn_ps_net_conns)
|
||
- [5.6.6.2. `psNetConnsMax`](#fn_ps_net_connsmax)
|
||
- [5.6.6.3. `psNetConnsPid`](#fn_ps_net_connspid)
|
||
- [5.6.6.4. `psNetConnsPidMax`](#fn_ps_net_connspidmax)
|
||
- [5.6.6.5. `psNetCTStats`](#fn_ps_net_ct)
|
||
- [5.6.6.6. `psNetCTStatList`](#fn_ps_net_ctlist)
|
||
- [5.6.6.7. `psNetFilterCnts`](#fn_ps_net_fltcnt)
|
||
- [5.6.6.8. `psNetIoCnts`](#fn_ps_net_iocnts)
|
||
- [5.6.6.9. `psNetIoCntsFile`](#fn_ps_net_iocntsfl)
|
||
- [5.6.6.10. `psNetIfaces`](#fn_ps_net_ifaces)
|
||
- [5.6.6.11. `psNetPids`](#fn_ps_net_pids)
|
||
- [5.6.6.12. `psNetProtoCnt`](#fn_ps_net_protocnts)
|
||
- [5.6.6.13. `psNetRev`](#fn_ps_net_rev)
|
||
- [5.6.7. Processes](#fn_ps_proc)
|
||
- [5.6.7.1. `psProcs`](#fn_ps_procs_procs)
|
||
- [5.6.7.2. `psProcNew`](#fn_ps_proc_new)
|
||
- [5.6.7.3. `psProcPids`](#fn_ps_proc_pids)
|
||
- [5.6.7.4. `psProcPidExists`](#fn_ps_proc_pidxst)
|
||
- [5.6.8. Sensors/Thermals](#fn_ps_sns)
|
||
- [5.6.8.1. `psSensorExTemp`](#fn_ps_sns_extemp)
|
||
- [5.6.8.2. `psSensorTemps`](#fn_ps_sns_temps)
|
||
- [5.6.9. Windows Services](#fn_ps_winsvc)
|
||
- [5.6.9.1. `psWinsvcList`](#fn_ps_winsvc_list)
|
||
- [5.6.9.2. `psWinsvcNew`](#fn_ps_winsvc_new)
|
||
- [5.7. Strings](#fn_str)
|
||
- [5.7.1. Standalone](#fn_str_stnd)
|
||
- [5.7.1.1. `extIndent`](#fn_str_stnd_extindent)
|
||
- [5.7.2. `r00t2.io/goutils/stringsx`](#fn_str_strsx)
|
||
- [5.7.2.1. `strsxIsAscii`](#fn_str_strsx_isascii)
|
||
- [5.7.2.2. `strsxIsAsciiBuf`](#fn_str_strsx_isasciibuf)
|
||
- [5.7.2.3. `strsxIsAsciiSpcl`](#fn_str_strsx_isasciispcl)
|
||
- [5.7.2.4. `strsxIsAsciiBufSpcl`](#fn_str_strsx_isasciibufspcl)
|
||
- [5.7.2.5. `strsxLenSpl`](#fn_str_strsx_lenspl)
|
||
- [5.7.2.6. `strsxLenSplStr`](#fn_str_strsx_lensplstr)
|
||
- [5.7.2.7. `strsxPad`](#fn_str_strsx_pad)
|
||
- [5.7.2.8. `strsxRedact`](#fn_str_strsx_rdct)
|
||
- [5.7.2.9. `strsxRev`](#fn_str_strsx_rev)
|
||
- [5.7.2.10. `strsxTrimLns`](#fn_str_strsx_trimlns)
|
||
- [5.7.2.11. `strsxTrimSpcLft`](#fn_str_strsx_trimspcl)
|
||
- [5.7.2.12. `strsxTrimSpcRt`](#fn_str_strsx_trimspcr)
|
||
- [5.8. System/Platform/Architecture](#fn_sys)
|
||
- [5.8.1. `sysArch`](#fn_sys_arch)
|
||
- [5.8.2. `sysNumCpu`](#fn_sys_numcpu)
|
||
- [5.8.3. `sysOsName`](#fn_sys_os)
|
||
- [5.8.4. `sysRuntime`](#fn_sys_rntm)
|
||
- [5.9. Time/Dates/Timestamps](#fn_tm)
|
||
- [5.9.1. `tmDate`](#fn_tm_date)
|
||
- [5.9.2. `tmFloatMicro`](#fn_tm_fltmic)
|
||
- [5.9.3. `tmFloatMilli`](#fn_tm_fltmill)
|
||
- [5.9.4. `tmFloatNano`](#fn_tm_fltnano)
|
||
- [5.9.5. `tmFloat`](#fn_tm_flt)
|
||
- [5.9.6. `tmFmt`](#fn_tm_fmt)
|
||
- [5.9.7. `tmNow`](#fn_tm_now)
|
||
- [5.9.8. `tmParseDur8n`](#fn_tm_pdur8n)
|
||
- [5.9.9. `tmParseMonth`](#fn_tm_pmnth)
|
||
- [5.9.10. `tmParseMonthInt`](#fn_tm_pmnthi)
|
||
- [5.9.11. `tmParseMonthStr`](#fn_tm_pmnths)
|
||
- [5.9.12. `tmParseTime`](#fn_tm_ptm)
|
||
- [6. TODO/Wishlist](#todo)
|
||
- [6.1. Function Collections](#todo_collctns)
|
||
- [6.2. Fallibility](#todo_fallible)
|
||
- [6.3. Function Scope Segregation](#todo_safe)
|
||
- [6.4. Extend OS functions](#todo_os)
|
||
- [6.4.1. Environment Variables](#todo_os_env)
|
||
- [6.5. System Functions](#todo_sys)
|
||
- [6.6. Encoding Functions](#todo_encode)
|
||
- [6.7. UUID Functions](#todo_uuid)
|
||
- [6.8. URL Functions](#todo_url)
|
||
- [6.9. Live Networking Functions](#todo_net)
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="content">
|
||
|
||
<div class="sect1">
|
||
|
||
## <a href="#wat" class="link">1. What is SprigX?</a>
|
||
|
||
<div class="sectionbody">
|
||
|
||
<div class="paragraph">
|
||
|
||
SprigX is a suite of extensions to <a href="https://masterminds.github.io/sprig/" target="_blank" rel="noopener">the <code>sprig</code> library</a> (<a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3" target="_blank" rel="noopener">Go docs</a>).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
They provide functions that offer more enriched use cases and domain-specific data.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>If you are reading this README on the Go Module Directory documentation (<a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx" class="bare">https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx</a>) or the directory landing page (<a href="https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx" class="bare">https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx</a>), it may not render correctly. Anchor-links (links within this document to other sections of this document) will likely also not work.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Be sure to view it at properly via <a href="https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx/README.adoc" target="_blank" rel="noopener">the in-repo AsciiDoc rendering</a> or by downloading and viewing the <a href="https://git.r00t2.io/r00t2/go_goutils/raw/branch/master/tplx/sprigx/README.html" target="_blank" rel="noopener">HTML version</a> in a browser locally and/or <a href="#rndr_pdf">rendering a PDF version</a>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect1">
|
||
|
||
## <a href="#rndr" class="link">2. How do I Render These Docs?</a>
|
||
|
||
<div class="sectionbody">
|
||
|
||
<div class="paragraph">
|
||
|
||
This documentation is written in <a href="https://asciidoc.org/" target="_blank" rel="noopener">AsciiDoc</a> (with <a href="https://asciidoctor.org/" target="_blank" rel="noopener">AsciiDoctor</a> extensions).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
To re-render all docs (including [PDF](#rndr_pdf)):
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
git clone https://git.r00t2.io/r00t2/go_goutils.git
|
||
cd go_goutils
|
||
.githooks/pre-commit/01-docgen
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#rndr_html" class="link">2.1. HTML</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
HTML output is re-rendered and included in git <a href="https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx/.githooks/pre-commit/01-docgen" target="_blank" rel="noopener">on each commit</a> automatically (via <a href="https://github.com/gabyx/Githooks" target="_blank" rel="noopener"><code>github:gabyx/Githooks</code></a>) but can be re-rendered on-demand locally via:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
git clone https://git.r00t2.io/r00t2/go_goutils.git
|
||
cd go_goutils
|
||
export orig_dir="$(pwd)"
|
||
cd tplx/sprigx
|
||
asciidoctor -a ROOTDIR="${orig_dir}/" -o README.html README.adoc
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#rndr_pdf" class="link">2.2. PDF</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
This documentation can be rendered to PDF via <a href="https://docs.asciidoctor.org/pdf-converter/latest/" target="_blank" rel="noopener"><code>asciidoctor-pdf</code></a>. It is not included in git automatically because binary files that change on each commit is not a good idea for git, especially for a repo that gets cloned as part of a library inclusion in a module/package dependency system (like `gomod`).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
To render as PDF:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
git clone https://git.r00t2.io/r00t2/go_goutils.git
|
||
cd go_goutils
|
||
export orig_dir="$(pwd)"
|
||
cd tplx/sprigx
|
||
asciidoctor-pdf -a ROOTDIR="${orig_dir}/" -o README.pdf README.adoc
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect1">
|
||
|
||
## <a href="#use" class="link">3. How do I Use SprigX?</a>
|
||
|
||
<div class="sectionbody">
|
||
|
||
<div class="paragraph">
|
||
|
||
The same way you would `sprig`!
|
||
|
||
</div>
|
||
|
||
Like this.
|
||
|
||
<div class="content">
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
package main
|
||
|
||
import (
|
||
htmlTplLib "html/template"
|
||
txtTplLib "text/template"
|
||
|
||
"r00t2.io/goutils/tplx/sprigx"
|
||
)
|
||
|
||
var (
|
||
txtTpl *txtTplLib.Template = txtTplLib.
|
||
New("").
|
||
Funcs(
|
||
sprigx.TxtFuncMap(),
|
||
)
|
||
htmlTpl *htmlTplLib.Template = htmlTplLib.
|
||
New("").
|
||
Funcs(
|
||
sprigx.HtmlFuncMap(),
|
||
)
|
||
)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
They can even be combined/used together,
|
||
|
||
</div>
|
||
|
||
like this.
|
||
|
||
<div class="content">
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
package main
|
||
|
||
import (
|
||
"text/template"
|
||
|
||
"github.com/Masterminds/sprig/v3"
|
||
"r00t2.io/goutils/tplx/sprigx"
|
||
)
|
||
|
||
var txtTpl *template.Template = template.
|
||
New("").
|
||
Funcs(
|
||
sprigx.TxtFuncMap(),
|
||
).
|
||
Funcs(
|
||
sprig.TxtFuncMap(),
|
||
)
|
||
// Or:
|
||
/*
|
||
var txtTpl *template.Template = template.
|
||
New("").
|
||
Funcs(
|
||
sprig.TxtFuncMap(),
|
||
).
|
||
Funcs(
|
||
sprigx.TxtFuncMap(),
|
||
)
|
||
*/
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Or, as a convenience, you can simply use the [`sprigx.CombinedTxtFuncMap`](#lib_cmbtfmap) and/or [`sprigx.CombinedHtmlFuncMap`](#lib_cmbhfmap) functions.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
If a `<template>.FuncMap` is added via `.Funcs()` **after** template parsing, it will override any functions of the same name of a `<template>.FuncMap` **before** parsing.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
For example, if both `sprig` and `sprigx` provide a function `foo`:
|
||
|
||
</div>
|
||
|
||
this will use `foo` from `sprigx`
|
||
|
||
<div class="content">
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
package main
|
||
|
||
import (
|
||
"text/template"
|
||
|
||
"github.com/Masterminds/sprig/v3"
|
||
"r00t2.io/goutils/tplx/sprigx"
|
||
)
|
||
|
||
const (
|
||
myTpl string = `{{ "This is an example template string." | foo }}`
|
||
)
|
||
|
||
var (
|
||
tpl *template.Template = template.Must(
|
||
template.
|
||
New("").
|
||
Funcs(sprig.TxtFuncMap()).
|
||
Parse(myTpl),
|
||
).
|
||
Funcs(sprigx.TxtFuncMap())
|
||
)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
whereas this will use `foo` from `sprig`
|
||
|
||
<div class="content">
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
package main
|
||
|
||
import (
|
||
"text/template"
|
||
|
||
"github.com/Masterminds/sprig/v3"
|
||
"r00t2.io/goutils/tplx/sprigx"
|
||
)
|
||
|
||
const (
|
||
myTpl string = `{{ "This is an example template string." | foo }}`
|
||
)
|
||
|
||
var (
|
||
tpl *template.Template = template.Must(
|
||
template.
|
||
New("").
|
||
Funcs(sprigx.TxtFuncMap()).
|
||
Parse(myTpl),
|
||
).
|
||
Funcs(sprig.TxtFuncMap())
|
||
)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
and a function can even be explicitly <span id="override"></span>overridden,
|
||
|
||
</div>
|
||
|
||
like this.
|
||
|
||
<div class="content">
|
||
|
||
<div class="paragraph">
|
||
|
||
This would override a function `foo` and `foo2` in `sprigx` from `foo` and `foo2` from `sprig`, but leave all other `sprig` functions untouched.
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
package main
|
||
|
||
import (
|
||
"text/template"
|
||
|
||
"github.com/Masterminds/sprig/v3"
|
||
"r00t2.io/goutils/tplx/sprigx"
|
||
)
|
||
|
||
const (
|
||
myTpl string = `{{ "This is an example template string." | foo }}`
|
||
)
|
||
|
||
var (
|
||
overrideFuncs template.FuncMap = sprig.TxtFuncMap()
|
||
tpl *template.Template = template.Must(
|
||
template.
|
||
New("").
|
||
Funcs(sprigx.TxtFuncMap()).
|
||
Parse(myTpl),
|
||
).
|
||
Funcs(
|
||
template.FuncMap(
|
||
map[string]any{
|
||
"foo": overrideFuncs["foo"],
|
||
"foo2": overrideFuncs["foo2"],
|
||
},
|
||
),
|
||
)
|
||
)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect1">
|
||
|
||
## <a href="#lib" class="link">4. Library Functions</a>
|
||
|
||
<div class="sectionbody">
|
||
|
||
<div class="paragraph">
|
||
|
||
These are generally intended to be used **outside** the template in the actual Go code.
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_cmbfmap" class="link">4.1. <code>CombinedFuncMap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func CombinedFuncMap(preferSprigX bool) (fmap map[string]any)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns a generic function map (like [`FuncMap`](#lib_fmap)) combined with <a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3#GenericFuncMap" target="_blank" rel="noopener"><code>github.com/Masterminds/sprig/v3.GenericFuncMap</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
If `preferSprigx` is true, SprigX function names will override Sprig functions with the same name. If false, Sprig functions will override conflicting SprigX functions with the same name.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
You probably want [`CombinedTxtFuncMap`](#lib_cmbtfmap) or [`CombinedHtmlFuncMap`](#lib_cmbhfmap) instead, as they wrap this with the appropriate type.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_cmbhfmap" class="link">4.2. <code>CombinedHtmlFuncMap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func CombinedHtmlFuncMap(preferSprigX bool) (fmap template.FuncMap)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns an [`html/template.FuncMap`](https://pkg.go.dev/html/template#FuncMap) function map (like [`HtmlFuncMap`](#lib_hfmap)) combined with <a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3#HtmlFuncMap" target="_blank" rel="noopener"><code>github.com/Masterminds/sprig/v3.HtmlFuncMap</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
If `preferSprigx` is true, SprigX function names will override Sprig functions with the same name. If false, Sprig functions will override conflicting SprigX functions with the same name.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_cmbtfmap" class="link">4.3. <code>CombinedTxtFuncMap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func CombinedTxtFuncMap(preferSprigX bool) (fmap template.FuncMap)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns a [`text/template.FuncMap`](https://pkg.go.dev/text/template#FuncMap) function map (like [`TxtFuncMap`](#lib_tfmap)) combined with <a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3#TxtFuncMap" target="_blank" rel="noopener"><code>github.com/Masterminds/sprig/v3.TxtFuncMap</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
If `preferSprigx` is true, SprigX function names will override Sprig functions with the same name. If false, Sprig functions will override conflicting SprigX functions with the same name.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_fmap" class="link">4.4. <code>FuncMap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func FuncMap() (fmap map[string]any)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns a generic SprigX function map.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
You probably want [`TxtFuncMap`](#lib_tfmap) or [`HtmlFuncMap`](#lib_hfmap) instead, as they wrap this with the appropriate type.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_hfmap" class="link">4.5. <code>HtmlFuncMap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func HtmlFuncMap() (fmap template.FuncMap)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns a SprigX <a href="https://pkg.go.dev/html/template#FuncMap" target="_blank" rel="noopener"><code>html/template.FuncMap</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_nop" class="link">4.6. <code>Nop</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func Nop(obj ...any) (s string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`Nop` is a NO-OP function that one can use in an [override map](#override) to explicitly disable certain Sprig/SprigX functions that may be deemed "unsafe" and/or to sanitize templates from untrusted input.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It will **never** error or panic, and `s` is **always** an empty string.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#lib_tfmap" class="link">4.7. <code>TxtFuncMap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func TxtFuncMap() (fmap template.FuncMap)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns a SprigX <a href="https://pkg.go.dev/text/template#FuncMap" target="_blank" rel="noopener"><code>text/template.FuncMap</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect1">
|
||
|
||
## <a href="#fn" class="link">5. Template Functions</a>
|
||
|
||
<div class="sectionbody">
|
||
|
||
<div class="paragraph">
|
||
|
||
Expect this list to grow over time, and potentially more frequently than the `sprigx` functions.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Each function includes its ***Function Signature*** to indicate what arguments/parameters it accepts, their type(s), what it returns, and the returned value(s) type(s).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Because Go template functions can only return either:
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- a single value of any type, or
|
||
|
||
- a value of any type and an `error` (in that order)
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
you can easily determine whether a function can return an error or not by simply referring to the Function Signature.
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_dbg" class="link">5.1. Debugging</a>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_dbg_dump" class="link">5.1.1. <code>dump</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dump(a ...interface{}) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
The `dump` function directly calls <a href="https://pkg.go.dev/davecgh/go-spew/spew#Sdump" target="_blank" rel="noopener"><code>github.com/davecgh/go-spew/spew.Sdump</code></a> for whatever object(s) is/are passed to it.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_meta" class="link">5.2. "Meta"/Template Helpers</a>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_meta_isnil" class="link">5.2.1. <code>metaIsNil</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func metaIsNil(obj any) (isNil bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`metaIsNil` returns `true` if `obj` is explicitly nil, otherwise it returns false.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function fills in the gap that <a href="https://pkg.go.dev/text/template#IsTrue" target="_blank" rel="noopener"><code>text/template.IsTrue</code></a> and <a href="https://pkg.go.dev/html/template#IsTrue" target="_blank" rel="noopener"><code>html/template.IsTrue</code></a> (expressed in templates as `{{ if … }}`) leaves, as those functions/expressions return false for e.g. `false` booleans AND nils.
|
||
|
||
</div>
|
||
|
||
<div class="literalblock">
|
||
|
||
<div class="content">
|
||
|
||
[id="fn_net_all"]
|
||
=== Networking
|
||
These template functions use capabilities from:
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- [`net`](#fn_net)
|
||
|
||
- [`net/netip`](#fn_netip)
|
||
|
||
- [`go4.org/netipx`](#fn_netipx)
|
||
|
||
- [`r00t2.io/goutils/netx`](#fn_netx)
|
||
|
||
- [`r00t2.io/goutils/netx/dnsx`](#fn_dnsx)
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
The function prefix is used to indicate which module/package a function is added from.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_net" class="link">5.2.2. <code>net</code></a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions contain capabilities from <a href="https://pkg.go.dev/net" target="_blank" rel="noopener"><code>net</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_cidrmask" class="link">5.2.2.1. <code>netCidrMask</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netCidrMask(ones, bits int) (mask net.IPMask)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netCidrMask` directly calls <a href="https://pkg.go.dev/net#CIDRMask" target="_blank" rel="noopener"><code>net.CIDRMask</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_cidra" class="link">5.2.2.2. <code>netExtractAddr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netExtractAddr(s string) (addr net.IP, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netExtractAddr` wraps <a href="https://pkg.go.dev/net#ParseCIDR" target="_blank" rel="noopener"><code>net.ParseCIDR</code></a> and returns the <a href="https://pkg.go.dev/net#IP" target="_blank" rel="noopener"><code>net.IP</code></a> component.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_hph" class="link">5.2.2.3. <code>netExtractHost</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netExtractHost(hostPort string) (host string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netExtractHost` wraps <a href="https://pkg.go.dev/net#SplitHostPort" target="_blank" rel="noopener"><code>net.SplitHostPort</code></a> and returns the host component (as a string).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_cidrn" class="link">5.2.2.4. <code>netExtractIpnet</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netExtractIpnet(s string) (ipNet *net.IPNet, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netExtractIpnet` wraps <a href="https://pkg.go.dev/net#ParseCIDR" target="_blank" rel="noopener"><code>net.ParseCIDR</code></a> and returns the <a href="https://pkg.go.dev/net#IPNet" target="_blank" rel="noopener"><code>net.IPNet</code></a> component.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_hpp" class="link">5.2.2.5. <code>netExtractPort</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netExtractPort(hostPort string) (port uint16, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netExtractPort` wraps <a href="https://pkg.go.dev/net#SplitHostPort" target="_blank" rel="noopener"><code>net.SplitHostPort</code></a> and returns the port component (as a uint16).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_ifaces" class="link">5.2.2.6. <code>netIfaces</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netIfaces() (ifaces []net.Interface, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netIfaces` directly calls <a href="https://pkg.go.dev/net#Interfaces" target="_blank" rel="noopener"><code>net.Interfaces</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_ip4mask" class="link">5.2.2.7. <code>netIp4Mask</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netIp4Mask(a, b, c, d any) (mask net.IPMask, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netIp4Mask` wraps <a href="https://pkg.go.dev/net#IPv4Mask" target="_blank" rel="noopener"><code>net.IPv4Mask</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It is wrapped so that `a`, `b`, `c`, and `d` may be a string:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $mask := netIp4Mask "198" "51" "100" "10" -}}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
or integers/other numeric:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $mask := netIp4Mask 198 51 100 10 -}}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
or bytes:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $mask := netIp4Mask 0xc6 0x33 0x64 0x0a -}}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
or even a mix:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $mask := netIp4Mask "198" 51 "100" 0x0a -}}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_jhp" class="link">5.2.2.8. <code>netJoinHostPort</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netJoinHostPort(host, port string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netJoinHostPort` directly calls <a href="https://pkg.go.dev/net#JoinHostPort" target="_blank" rel="noopener"><code>net.JoinHostPort</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_net_parseip" class="link">5.2.2.9. <code>netParseIP</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netParseIP(s string) (ip net.IP)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netParseIP` directly calls <a href="https://pkg.go.dev/net#ParseIP" target="_blank" rel="noopener"><code>net.ParseIP</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_netip" class="link">5.2.3. <code>net/netip</code></a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions contain capabilities from <a href="https://pkg.go.dev/net/netip" target="_blank" rel="noopener"><code>net/netip</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netip_addrport" class="link">5.2.3.1. <code>netipAddrPort</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipAddrPort(ip netip.Addr, port uint16) (addrPort netip.AddrPort)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipAddrPort` directly calls <a href="https://pkg.go.dev/net/netip#AddrPortFrom" target="_blank" rel="noopener"><code>net/netip.AddrPortFrom</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netip_parseaddr" class="link">5.2.3.2. <code>netipParseAddr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipParseAddr(s string) (addr netip.Addr, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipParseAddr` directly calls <a href="https://pkg.go.dev/net/netip#ParseAddr" target="_blank" rel="noopener"><code>net/netip.ParseAddr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netip_pap" class="link">5.2.3.3. <code>netipParseAddrPort</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipParseAddrPort(s string) (addrPort netip.AddrPort, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipParseAddrPort` directly calls <a href="https://pkg.go.dev/net/netip#ParseAddrPort" target="_blank" rel="noopener"><code>net/netip.ParseAddrPort</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netip_parsepfx" class="link">5.2.3.4. <code>netipParsePrefix</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipParsePrefix(s string) (pfx netip.Prefix, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipParsePrefix` directly calls <a href="https://pkg.go.dev/net/netip#ParsePrefix" target="_blank" rel="noopener"><code>net/netip.ParsePrefix</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netip_pfx" class="link">5.2.3.5. <code>netipPrefix</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipPrefix(ip netip.Addr, bits int) (pfx netip.Prefix)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipPrefix` directly calls <a href="https://pkg.go.dev/net/netip#PrefixFrom" target="_blank" rel="noopener"><code>net/netip.PrefixFrom</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_netipx" class="link">5.2.4. <code>go4.org/netipx</code></a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions contain capabilities from <a href="https://pkg.go.dev/go4.org/netipx" target="_blank" rel="noopener"><code>go4.org/netipx</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_addripnet" class="link">5.2.4.1. <code>netipxAddrIpNet</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxAddrIpNet(addr netip.Addr) (ipNet *net.IPNet)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxAddrIpNet` directly calls <a href="https://pkg.go.dev/go4.org/netipx#AddrIPNet" target="_blank" rel="noopener"><code>go4.org/netipx.AddrIPNet</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_cmppfx" class="link">5.2.4.2. <code>netipxCmpPfx</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxCmpPfx(a, b netip.Prefix) (cmp int)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxCmpPfx` directly calls <a href="https://pkg.go.dev/go4.org/netipx#ComparePrefix" target="_blank" rel="noopener"><code>go4.org/netipx.ComparePrefix</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_fromstdaddr" class="link">5.2.4.3. <code>netipxFromStdAddr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxFromStdAddr(ip net.IP, port int, zone string) (addrPort netip.AddrPort, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxFromStdAddr` wraps <a href="https://pkg.go.dev/go4.org/netipx#FromStdAddr" target="_blank" rel="noopener"><code>go4.org/netipx.FromStdAddr</code></a>. Instead of returning a boolean as the second value, it will instead be an error if the wrapped boolean is false.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_fromip" class="link">5.2.4.4. <code>netipxFromIp</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxFromIp(ip net.IP) (addr netip.Addr, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxFromIp` wraps <a href="https://pkg.go.dev/go4.org/netipx#FromStdIP" target="_blank" rel="noopener"><code>go4.org/netipx.FromStdIP</code></a>. Instead of returning a boolean as the second value, it will instead be an error if the wrapped boolean is false.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_fromipnet" class="link">5.2.4.5. <code>netipxFromIpNet</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxFromIpNet(ipNet *net.IPNet) (pfx netip.Prefix, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxFromIpNet` wraps <a href="https://pkg.go.dev/go4.org/netipx#FromStdIPNet" target="_blank" rel="noopener"><code>go4.org/netipx.FromStdIPNet</code></a>. Instead of returning a boolean as the second value, it will instead be an error if the wrapped boolean is false.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_parserange" class="link">5.2.4.6. <code>netipxParseRange</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxParseRange(s string) (ipRange netipx.IPRange, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxParseRange` directly calls <a href="https://pkg.go.dev/go4.org/netipx#ParseIPRange" target="_blank" rel="noopener"><code>go4.org/netipx.ParseIPRange</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_pfxaddr" class="link">5.2.4.7. <code>netipxPfxAddr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxPfxAddr(s string) (addr netip.Addr, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxPfxAddr` directly calls <a href="https://pkg.go.dev/go4.org/netipx#ParsePrefixOrAddr" target="_blank" rel="noopener"><code>go4.org/netipx.ParsePrefixOrAddr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_pfxipnet" class="link">5.2.4.8. <code>netipxPfxIpNet</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxPfxIpNet(pfx netip.Prefix) (ipNet *net.IPNet)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxPfxIpNet` directly calls <a href="https://pkg.go.dev/go4.org/netipx#PrefixIPNet" target="_blank" rel="noopener"><code>go4.org/netipx.PrefixIPNet</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_pfxlast" class="link">5.2.4.9. <code>netipxPfxLast</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxPfxLast(pfx netip.Prefix) (addr netip.Addr)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxPfxLast` directly calls <a href="https://pkg.go.dev/go4.org/netipx#PrefixLastIP" target="_blank" rel="noopener"><code>go4.org/netipx.PrefixLastIP</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_pfxrange" class="link">5.2.4.10. <code>netipxPfxRange</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxPfxRange(pfx netip.Prefix) (ipRange netipx.IPRange)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxPfxRange` directly calls <a href="https://pkg.go.dev/go4.org/netipx#RangeOfPrefix" target="_blank" rel="noopener"><code>go4.org/netipx.RangeOfPrefix</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netipx_range" class="link">5.2.4.11. <code>netipxRange</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netipxRange(from, to netip.Addr) (ipRange netipx.IPRange)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netipxRange` directly calls <a href="https://pkg.go.dev/go4.org/netipx#IPRangeFrom" target="_blank" rel="noopener"><code>go4.org/netipx.IPRangeFrom</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_netx" class="link">5.2.5. <code>r00t2.io/goutils/netx</code></a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions contain capabilities from <a href="https://pkg.go.dev/r00t2.io/goutils/netx" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_addrrfc" class="link">5.2.5.1. <code>netxAddrRfc</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxAddrRfc(addr netip.Addr) (rfcStr string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxAddrRfc` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#AddrRfc" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.AddrRfc</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_cidr4ipmask" class="link">5.2.5.2. <code>netxAddrRfc</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxAddrRfc(cidr uint8) (ipMask net.IPMask, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxCidr4IpMask` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Cidr4ToIPMask" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Cidr4ToIPMask</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_cidr4mask" class="link">5.2.5.3. <code>netxCidr4Mask</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxCidr4Mask(cidr uint8) (mask uint32, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxCidr4IpMask` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Cidr4ToMask" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Cidr4ToMask</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_cidr4str" class="link">5.2.5.4. <code>netxCidr4Str</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxCidr4Str(cidr uint8) (maskStr string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxCidr4Str` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Cidr4ToStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Cidr4ToStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_familyver" class="link">5.2.5.5. <code>netxFamilyVer</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxFamilyVer(family uint16) (ipVer int)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxFamilyVer` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#FamilyToVer" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.FamilyToVer</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_getaddrfam" class="link">5.2.5.6. <code>netxGetAddrFam</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxGetAddrFam(addr netip.Addr) (family uint16)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxGetAddrFam` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#GetAddrFamily" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.GetAddrFamily</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_getipfam" class="link">5.2.5.7. <code>netxGetIpFam</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxGetIpFam(ip net.IP) (family uint16)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxGetIpFam` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#GetAddrFamily" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.GetIpFamily</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_iprfc" class="link">5.2.5.8. <code>netxIpRfc</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIpRfc(ip net.IP) (rfcStr string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIpRfc` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IpRfc" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IpRfc</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_iprfcstr" class="link">5.2.5.9. <code>netxIpRfcStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIpRfcStr(s string) (rfcStr string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIpRfcStr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IpRfcStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IpRfcStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ipstriprfc" class="link">5.2.5.10. <code>netxIpStripRfc</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIpStripRfc(s string) (stripStr string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIpStripRfc` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IpStripRfcStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IpStripRfcStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ip4maskcidr" class="link">5.2.5.11. <code>netxIp4MaskCidr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIp4MaskCidr(ipMask net.IPMask) (cidr uint8, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIp4MaskCidr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IPMask4ToCidr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IPMask4ToCidr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ip4maskmask" class="link">5.2.5.12. <code>netxIp4MaskMask</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIp4MaskMask(ipMask net.IPMask) (mask uint32, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIp4MaskMask` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IPMask4ToMask" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IPMask4ToMask</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ip4maskstr" class="link">5.2.5.13. <code>netxIp4MaskStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIp4MaskStr(ipMask net.IPMask) (maskStr string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIp4MaskStr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IPMask4ToStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IPMask4ToStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ipverstr" class="link">5.2.5.14. <code>netxIpVerStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIpVerStr(s string) (ipVer int)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIpVerStr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IpVerStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IpVerStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_isbrktd6" class="link">5.2.5.15. <code>netxIsBrktd6</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIsBrktd6(s string) (isBrktdIp bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIsBrktd6` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IsBracketedIp6" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IsBracketedIp6</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_isip" class="link">5.2.5.16. <code>netxIsIp</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIsIp(s string) (isIp bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIsIp` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IsIpAddr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IsIpAddr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ispfx" class="link">5.2.5.17. <code>netxIsPfx</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxIsPfx(s string) (isNet bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxIsPfx` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#IsPrefixNet" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.IsPrefixNet</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_mask4cidr" class="link">5.2.5.18. <code>netxMask4Cidr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxMask4Cidr(mask uint32) (cidr uint8, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxMask4Cidr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Mask4ToCidr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Mask4ToCidr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_mask4Strcidr" class="link">5.2.5.19. <code>netxMask4StrCidr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxMask4StrCidr(maskStr string) (cidr uint8, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxMask4StrCidr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Mask4StrToCidr" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Mask4StrToCidr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_mask4stripmask" class="link">5.2.5.20. <code>netxMask4StrIpMask</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxMask4StrIpMask(maskStr string) (mask net.IPMask, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxMask4StrIpMask` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Mask4StrToIPMask" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Mask4StrToIPMask</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_mask4strmask" class="link">5.2.5.21. <code>netxMask4StrMask</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxMask4StrMask(maskStr string) (mask uint32, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxMask4StrMask` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#Mask4StrToMask" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.Mask4StrToMask</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_netx_ver2fam" class="link">5.2.5.22. <code>netxVerFamily</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func netxVerFamily(ipVer int) (family uint16)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`netxVerFamily` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/netx#VerToFamily" target="_blank" rel="noopener"><code>r00t2.io/goutils/netx.VerToFamily</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_dnsx" class="link">5.2.6. <code>r00t2.io/goutils/netx/dnsx</code></a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions contain capabilities from <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_ptraddr" class="link">5.2.6.1. <code>dnsxPtrAddr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxPtrAddr(s string) (ip netip.Addr, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxPtrAddr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#AddrFromPtr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.AddrFromPtr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_addrptr" class="link">5.2.6.2. <code>dnsxAddrPtr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxAddrPtr(ip netip.Addr) (s string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxAddrPtr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#AddrToPtr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.AddrToPtr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_str2wire" class="link">5.2.6.3. <code>dnsxStrWire</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxStrWire(recordNm string) (recordNmBytes []byte, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxStrWire` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#DnsStrToWire" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.DnsStrToWire</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_wire2str" class="link">5.2.6.4. <code>dnsxWireStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxWireStr(recordNmBytes []byte) (recordNm string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxWireStr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#DnsWireToStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.DnsWireToStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_ptrip" class="link">5.2.6.5. <code>dnsxPtrIp</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxPtrIp(s string) (ip net.IP, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxPtrIp` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IpFromPtr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IpFromPtr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_ipptr" class="link">5.2.6.6. <code>dnsxIpPtr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIpPtr(ip net.IP) (s string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIpPtr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IpToPtr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IpToPtr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_isfqdn" class="link">5.2.6.7. <code>dnsxIsFqdn</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsFqdn(s string) (fqdn bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsFqdn` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsFqdn" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdn</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_istxt" class="link">5.2.6.8. <code>dnsxIsTxt</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsTxt(fqdn string) (isOk bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsTxt` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsFqdnDefinedTxt" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnDefinedTxt</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_isnsec3" class="link">5.2.6.9. <code>dnsxIsNsec3</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsNsec3(s string) (maybeNsec3 bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsNsec3` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsFqdnNsec3" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnNsec3</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_issrv" class="link">5.2.6.10. <code>dnsxIsSrv</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsSrv(s string) (srv bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsSrv` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsFqdnSrv" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnSrv</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_iswild" class="link">5.2.6.11. <code>dnsxIsWild</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsWild(s string) (wildcard bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsWild` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsFqdnWildcard" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnWildcard</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_islbl" class="link">5.2.6.12. <code>dnsxIsLbl</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsLbl(s string) (isLbl bool)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsLbl` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsLabel" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsLabel</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_dnsx_isptr" class="link">5.2.6.13. <code>dnsxIsPtr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func dnsxIsPtr(s string) (isPtr bool, addr net.IP)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`dnsxIsPtr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/netx/dnsx#IsPtr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsPtr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_num" class="link">5.3. Numbers/Math</a>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_num_f32s" class="link">5.3.1. <code>numFloat32Str</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func numFloat32Str(f float32) (s string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`numFloat32Str` returns a **complete** non-truncated non-right-padded string representation of a `float32`.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_num_f64" class="link">5.3.2. <code>numFloat64</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func numFloat64(val any) (f float64, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`numFloat64` returns any string representation of a numeric value or any type of numeric value to a `float64`.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_num_f64s" class="link">5.3.3. <code>numFloat64Str</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func numFloat64Str(f float64) (s string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`numFloat64Str` returns a **complete** non-truncated non-right-padded string representation of a `float64`.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_num_fs" class="link">5.3.4. <code>numFloatStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func numFloatStr(val any) (s string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`numFloatStr` wraps [`numFloat32Str`](#fn_num_f32s) and [`numFloat64Str`](#fn_num_f64s).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`val` can be a string representation of any numeric value or any type of numeric value.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_os" class="link">5.4. Operating System</a>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_fqdn" class="link">5.4.1. <code>osFQDN</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osFQDN() (fqdn string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osFQDN` currently just directly calls <a href="https://pkg.go.dev/os#Hostname" target="_blank" rel="noopener"><code>os.Hostname</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
As such, it comes with the same caveats — namely that it isn’t guaranteed to be an FQDN, it will be precisely/exactly whatever the kernel/OS hostname is set as.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
In the future, it may be extended to support a more diligent effort to determine an actual FQDN, and return an error if it is unable to be derived.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
To (relatively) predictably get the "short hostname", use [`osHost`](#fn_os_hst). To directly/predictably use <a href="https://pkg.go.dev/os#Hostname" target="_blank" rel="noopener"><code>os.Hostname</code></a>, use [`osHostname`](#fn_os_hstnm).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_grpid" class="link">5.4.2. <code>osGroupById</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osGroupById[T string | int](gid T) (g *user.Group, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osGroupById` returns an <a href="https://pkg.go.dev/os/user#Group" target="_blank" rel="noopener"><code>os/user.Group</code></a> from a given group ID/GID.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It more or less behaves exactly like <a href="https://pkg.go.dev/os/user#LookupGroupId" target="_blank" rel="noopener"><code>os/user.LookupGroupId</code></a>, except it will accept either a `string` **or** an `int` as the GID.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_grpnm" class="link">5.4.3. <code>osGroupByName</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osGroupByName(grpNm string) (g *user.Group, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osGroupByName` returns an <a href="https://pkg.go.dev/os/user#Group" target="_blank" rel="noopener"><code>os/user.Group</code></a> from a given group name.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It behaves exactly like <a href="https://pkg.go.dev/os/user#LookupGroup" target="_blank" rel="noopener"><code>os/user.LookupGroup</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_hst" class="link">5.4.4. <code>osHost</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osHost() (out string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osHost` returns the "short hostname" by calling <a href="https://pkg.go.dev/os#Hostname" target="_blank" rel="noopener"><code>os.Hostname</code></a> and returning the first "host label" (as RFCs refer to it). This is commonly/colloquially called the "hostname" or "hostname without the domain part".
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
e.g.:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $fqdn := osFQDN -}}
|
||
{{- $h := osHost -}}
|
||
{{- $cmp := index ($fqdn | splitList ".") 0 -}}
|
||
osHost {{ $h }} should be equal to first label of FQDN {{ $cmp }}.
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>The <code>splitList</code> function shown above is from the <a href="https://masterminds.github.io/sprig/string_slice.html" target="_blank" rel="noopener"><code>sprig</code> string slice functions</a>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
To (try to) get the FQDN, use [`osFQDN`](#fn_os_fqdn). To directly use <a href="https://pkg.go.dev/os#Hostname" target="_blank" rel="noopener"><code>os.Hostname</code></a>, use [`osHostname`](#fn_os_hstnm).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_hstnm" class="link">5.4.5. <code>osHostname</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osHostname() (out string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osHostname` directly calls <a href="https://pkg.go.dev/os#Hostname" target="_blank" rel="noopener"><code>os.Hostname</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_idst" class="link">5.4.6. <code>osIdState</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osIdState() (idst sysutils.IDState)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osIdState` returns the current runtime process' <a href="https://pkg.go.dev/r00t2.io/sysutils#IDState" target="_blank" rel="noopener"><code>r00t2.io/sysutils.IDState</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It directly calls <a href="https://pkg.go.dev/r00t2.io/sysutils#GetIDState" target="_blank" rel="noopener"><code>r00t2.io/sysutils.GetIDState</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This is more or less useless on Windows; it returns only a dummy struct for cross-platform compatibility.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_usr" class="link">5.4.7. <code>osUser</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osUser() (u *user.User, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osUser` returns the current runtime process' <a href="https://pkg.go.dev/os/user#User" target="_blank" rel="noopener"><code>os/user.User</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It directly calls <a href="https://pkg.go.dev/os/user#Current" target="_blank" rel="noopener"><code>os/user.Current</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_usrid" class="link">5.4.8. <code>osUserById</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osUserById[T string | int](uid T) (u *user.User, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osUserById` returns an <a href="https://pkg.go.dev/os/user#User" target="_blank" rel="noopener"><code>os/user.User</code></a> from a given user ID/UID.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It more or less behaves exactly like <a href="https://pkg.go.dev/os/user#LookupId" target="_blank" rel="noopener"><code>os/user.LookupId</code></a>, except it will accept either a `string` **or** an `int` as the UID.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_os_usrnm" class="link">5.4.9. <code>osUserByName</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osUserByName(userNm string) (u *user.User, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osUserByName` returns an <a href="https://pkg.go.dev/os/user#User" target="_blank" rel="noopener"><code>os/user.User</code></a> from a given username.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It directly calls <a href="https://pkg.go.dev/os/user#Lookup" target="_blank" rel="noopener"><code>os/user.Lookup</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_path" class="link">5.5. Paths</a>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_path_gnrc" class="link">5.5.1. Generic</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These operate similar to <a href="https://pkg.go.dev/path" target="_blank" rel="noopener">the <code>path</code> stdlib library</a> and use a fixed `/` path separator.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_gnrc_pj" class="link">5.5.1.1. <code>pathJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func pathJoin(elem ...string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`pathJoin` directly calls <a href="https://pkg.go.dev/path#Join" target="_blank" rel="noopener"><code>path.Join</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>If you are joining paths in a pipeline, you almost assuredly want <a href="#fn_path_gnrc_ppj"><code>pathPipeJoin</code></a> or <a href="#fn_path_gnrc_pspj"><code>pathSlicePipeJoin</code></a> instead unless you are explicitly <strong>appending</strong> a pipeline result to a path.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- pathJoin "a" "b" "c" }}
|
||
{{- pathJoin "/" "a" "b" "c" }}
|
||
{{- pathJoin "/a/b" "c" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
a/b/c
|
||
/a/b/c
|
||
/a/b/c
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_gnrc_ppj" class="link">5.5.1.2. <code>pathPipeJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func pathPipeJoin(elems ...string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`pathPipeJoin` operates like [`pathJoin`](#fn_path_gnrc_pj) with one deviation: the root/base path is expected to be **last** in the arguments.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This makes it much more suitable for use in template pipelines, as the previous value in a pipeline is passed in as the last element to the next pipe function.
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $myBase := "/a" -}}
|
||
{{- pathPipeJoin "b" "c" "a" }}
|
||
{{- pathPipeJoin "a" "b" "c" "/" }}
|
||
{{- $myBase | pathPipeJoin "b" "c" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
a/b/c
|
||
/a/b/c
|
||
/a/b/c
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_gnrc_psj" class="link">5.5.1.3. <code>pathSliceJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func pathSliceJoin(sl []string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`pathSliceJoin` joins a slice of path segment strings (`[]string`) instead of a variadic sequence of strings.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>The <code>splitList</code> function shown below is from the <a href="https://masterminds.github.io/sprig/string_slice.html" target="_blank" rel="noopener"><code>sprig</code> string slice functions</a>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $myList := "a,b,c" | splitList "," -}}
|
||
{{- $myList | pathSliceJoin }}
|
||
{{- ("a,b,c" | splitList ",") | pathSliceJoin }}
|
||
{{- ("/,a,b,c" | splitList ",") | pathSliceJoin }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
a/b/c
|
||
a/b/c
|
||
/a/b/c
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_gnrc_pspj" class="link">5.5.1.4. <code>pathSlicePipeJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func pathSlicePipeJoin(sl []string, root string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`pathSlicePipeJoin` operates like a hybrid of [`pathPipeJoin`](#fn_path_gnrc_ppj) and [`pathSliceJoin`](#fn_path_gnrc_psj):
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- Like [`pathPipeJoin`](#fn_path_gnrc_ppj), it is suitable for pipeline use — the root/base path is passed in from the pipeline
|
||
|
||
- Like [`pathSliceJoin`](#fn_path_gnrc_psj), it **also** accepts a slice of path segments (`[]string`) to append to that base path
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>The <code>splitList</code> function shown below is from the <a href="https://masterminds.github.io/sprig/string_slice.html" target="_blank" rel="noopener"><code>sprig</code> string slice functions</a>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $myBase := "/a" -}}
|
||
{{- $myList := "b,c,d" | splitList "." -}}
|
||
{{- pathSlicePipeJoin $myList $myBase }}
|
||
{{- $myBase | pathSlicePipeJoin $myList }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
/a/b/c
|
||
/a/b/c
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_gnrc_psubj" class="link">5.5.1.5. <code>pathSubJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func pathSubJoin(root string, elems ...string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`pathSubJoin` operates like [`pathJoin`](#fn_path_gnrc_pj) but it expects an explicit root/base path.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
The pipeline-friendly equivalent of this is [`pathPipeJoin`](#fn_path_gnrc_ppj).
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- pathSubJoin "/a/b" "c" }}
|
||
{{- pathSubJoin "/" "a" "b" "c" }}
|
||
{{- "c" | pathSubJoin "/" "a" "b" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
/a/b/c
|
||
/a/b/c
|
||
/a/b/c
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_path_os" class="link">5.5.2. OS/Platform-Tailored</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These operate similar to <a href="https://pkg.go.dev/path/filepath" target="_blank" rel="noopener">the <code>path/filepath</code> stdlib library</a>, and use the OS-specific <a href="https://pkg.go.dev/os#PathSeparator" target="_blank" rel="noopener"><code>os.PathSeparator</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>Take special note of the oddness around specifying Windows paths and drive letters in e.g. <a href="#fn_path_os_pj"><code>osPathJoin</code></a>!</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>It is recommended to make use of <a href="#fn_sys_os"><code>sysOsName</code></a> to conditionally format path bases/roots if needed.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_os_pj" class="link">5.5.2.1. <code>osPathJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osPathJoin(elem ...string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osPathJoin` directly calls <a href="https://pkg.go.dev/path/filepath#Join" target="_blank" rel="noopener"><code>path/filepath.Join</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>If you are joining paths in a pipeline, you almost assuredly want <a href="#fn_path_os_ppj"><code>osPathPipeJoin</code></a> or <a href="#fn_path_os_pspj"><code>osPathSlicePipeJoin</code></a> instead unless you are explicitly <strong>appending</strong> a pipeline result to a path.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- osPathJoin "a" "b" "c" }}
|
||
{{- osPathJoin "/" "a" "b" "c" }}
|
||
{{- osPathJoin "C:\\" "a" "b" "c" }}
|
||
{{- osPathJoin "C:" "a" "b" "c" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch">
|
||
<colgroup>
|
||
<col style="width: 33%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">OS</th>
|
||
<th class="tableblock halign-center valign-middle">Result</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>a\b\c
|
||
\a\b\c
|
||
\a\b\c
|
||
C:\a\b\c
|
||
C:a\b\c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Others (e.g. Linux, macOS)</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>a/b/c
|
||
/a/b/c
|
||
C:\/a/b/c
|
||
C:/a/b/c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_os_ppj" class="link">5.5.2.2. <code>osPathPipeJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osPathJoin(elems ...string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osPathPipeJoin` operates like [`pathPipeJoin`](#fn_path_gnrc_ppj) (except using OS-specific path separators).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This makes it much more suitable for use in template pipelines, as the previous value in a pipeline is passed in as the last argument to the next pipe function.
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $myBase := "/a" -}}
|
||
{{- osPathPipeJoin "b" "c" "a" }}
|
||
{{- osPathPipeJoin "a" "b" "c" "/" }}
|
||
{{- $myBase | osPathPipeJoin "b" "c" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch">
|
||
<colgroup>
|
||
<col style="width: 33%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">OS</th>
|
||
<th class="tableblock halign-center valign-middle">Result</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>a\b\c
|
||
\a\b\c
|
||
\a\b\c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Others (e.g. Linux, macOS)</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>a/b/c
|
||
/a/b/c
|
||
/a/b/c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_ossep" class="link">5.5.2.3. <code>osPathSep</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osPathSep() (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osPathSep` returns the <a href="https://pkg.go.dev/os#PathSeparator" target="_blank" rel="noopener"><code>os.PathSeparator</code></a> for this OS.
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- osPathSep }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch">
|
||
<colgroup>
|
||
<col style="width: 33%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">OS</th>
|
||
<th class="tableblock halign-center valign-middle">Result</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>\</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Others (e.g. Linux, macOS)</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>/</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_os_psj" class="link">5.5.2.4. <code>osPathSliceJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osPathSliceJoin(sl []string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osPathSliceJoin` operates like [`pathSliceJoin`](#fn_path_gnrc_psj) but with OS-specific path separators.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>The <code>splitList</code> function shown below is from the <a href="https://masterminds.github.io/sprig/string_slice.html" target="_blank" rel="noopener"><code>sprig</code> string slice functions</a>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $myList := "a,b,c" | splitList "," -}}
|
||
{{- $myList | osPathSliceJoin }}
|
||
{{- ("a,b,c" | splitList ",") | osPathSliceJoin }}
|
||
{{- ("/,a,b,c" | splitList ",") | osPathSliceJoin }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch">
|
||
<colgroup>
|
||
<col style="width: 33%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">OS</th>
|
||
<th class="tableblock halign-center valign-middle">Result</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>a\b\c
|
||
a\b\c
|
||
\a\b\c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Others (e.g. Linux, macOS)</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>a/b/c
|
||
a/b/c
|
||
/a/b/c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_os_pspj" class="link">5.5.2.5. <code>osPathSlicePipeJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osPathSlicePipeJoin(sl []string, root string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osPathSlicePipeJoin` operates like [`pathSlicePipeJoin`](#fn_path_gnrc_pspj) but with OS-specific separators.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>The <code>splitList</code> function shown below is from the <a href="https://masterminds.github.io/sprig/string_slice.html" target="_blank" rel="noopener"><code>sprig</code> string slice functions</a>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $myBase := "/a" -}}
|
||
{{- $myList := "b,c,d" | splitList "." -}}
|
||
{{- osPathSlicePipeJoin $myList $myBase }}
|
||
{{- $myBase | osPathSlicePipeJoin $myList }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch">
|
||
<colgroup>
|
||
<col style="width: 33%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">OS</th>
|
||
<th class="tableblock halign-center valign-middle">Result</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>\a\b\c\d
|
||
\a\b\c\d</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Others (e.g. Linux, macOS)</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>/a/b/c/d
|
||
/a/b/c/d</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_path_os_psubj" class="link">5.5.2.6. <code>osPathSubJoin</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func osPathSubJoin(root string, elems ...string) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`osPathSubJoin` operates like [`pathSubJoin`](#fn_path_gnrc_psubj) but with OS-specific separators.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
The pipeline-friendly equivalent of this is [`osPathPipeJoin`](#fn_path_os_ppj).
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- osPathSubJoin "/a/b" "c" }}
|
||
{{- osPathSubJoin "/" "a" "b" "c" }}
|
||
{{- "c" | osPathSubJoin "/" "a" "b" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
renders as:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch">
|
||
<colgroup>
|
||
<col style="width: 33%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">OS</th>
|
||
<th class="tableblock halign-center valign-middle">Result</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>\a\b\c
|
||
\a\b\c
|
||
\a\b\c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p>Others (e.g. Linux, macOS)</p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="rouge highlight"><code>/a/b/c
|
||
/a/b/c
|
||
/a/b/c</code></pre>
|
||
</div>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_ps" class="link">5.6. PSUtil</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These are functions from <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4</code></a> packages.
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_cpu" class="link">5.6.1. CPU/Processor</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_cpu_cnts" class="link">5.6.1.1. <code>psCpuCnts</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psCpuCnts(logical bool) (numCpu int, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psCpuCnts` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Counts" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Counts</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_cpu_info" class="link">5.6.1.2. <code>psCpuInfo</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psCpuInfo() (cpuInfo []cpu.Info, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psCpuInfo` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Info" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Info</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_cpu_pct" class="link">5.6.1.3. <code>psCpuPct</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psCpuPct(interval time.Duration, percpu bool) (pcts []float64, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psCpuPct` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Percent" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Percent</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_cpu_tms" class="link">5.6.1.4. <code>psCpuTimes</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psCpuTimes(percpu bool) (cpuTimes []cpu.TimesStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psCpuTimes` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Times" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Times</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_dsk" class="link">5.6.2. Disk</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_dsk_iocnts" class="link">5.6.2.1. <code>psDiskIoCnts</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psDiskIoCnts(names ...string) (stats map[string]disk.IOCountersStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psDiskIoCnts` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#IOCounters" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.IOCounters</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_dsk_lbl" class="link">5.6.2.2. <code>psDiskLabel</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psDiskLabel(name string) (label string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psDiskLabel` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#Label" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.Label</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_dsk_parts" class="link">5.6.2.3. <code>psDiskParts</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psDiskParts(all bool) (parts []disk.PartitionStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psDiskParts` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#Partitions" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.Partitions</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_dsk_srl" class="link">5.6.2.4. <code>psDiskSerial</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psDiskSerial(name string) (serial string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psDiskSerial` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#SerialNumber" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.SerialNumber</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_dsk_usg" class="link">5.6.2.5. <code>psDiskUsage</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psDiskUsage(path string) (usage *disk.UsageStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psDiskUsage` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#Usage" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.Usage</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_hst" class="link">5.6.3. Host</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_boot" class="link">5.6.3.1. <code>psHostBoot</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostBoot() (bootEpoch uint64, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostBoot` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#BootTime" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.BootTime</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_id" class="link">5.6.3.2. <code>psHostId</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostId() (hostId string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostId` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#HostID" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.HostID</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_info" class="link">5.6.3.3. <code>psHostInfo</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostInfo() (info *host.InfoStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostInfo` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Info" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Info</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_krnarch" class="link">5.6.3.4. <code>psHostKernArch</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostKernArch() (arch string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostKernArch` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#KernelArch" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.KernelArch</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_krnver" class="link">5.6.3.5. <code>psHostKernVer</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostKernVer() (ver string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostKernVer` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#KernelVersion" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.KernelVersion</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_plat" class="link">5.6.3.6. <code>psHostPlatInfo</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostPlatInfo() (platInfo [3]string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostPlatInfo` wraps <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#PlatformInformation" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.PlatformInformation</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It is necessary to wrap because the function normally returns `(string, string, string, error)` but a template function may only return either a single value (of any type) or a single value of any type and an error, so the three `string` returns are consolidated into an ordered `[3]string`.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_uptm" class="link">5.6.3.7. <code>psHostPlatUptime</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostPlatUptime() (uptimeSecs uint64, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostPlatUptime` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Uptime" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Uptime</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_usrs" class="link">5.6.3.8. <code>psHostUsers</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostUsers() (users []host.UserStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostUsers` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Users" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Users</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_hst_virt" class="link">5.6.3.9. <code>psHostPlatVirt</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psHostPlatVirt() (virtInfo [2]string, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psHostPlatVirt` wraps <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Virtualization" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Virtualization</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It is necessary to wrap because the function normally returns `(string, string, error)` but a template function may only return either a single value (of any type) or a single value of any type and an error, so the two `string` returns are consolidated into an ordered `[2]string`.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_ld" class="link">5.6.4. Load</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_ld_avg" class="link">5.6.4.1. <code>psLoadAvg</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psLoadAvg() (avg *load.AvgStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psLoadAvg` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/load#Avg" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/load.Avg</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_ld_misc" class="link">5.6.4.2. <code>psLoadMisc</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psLoadMisc() (misc *load.MiscStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psLoadMisc` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/load#Misc" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/load.Misc</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_mem" class="link">5.6.5. Memory</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_mem_exvmem" class="link">5.6.5.1. <code>psMemExVMem</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psMemExVMem() (exVMem *mem.ExVirtualMemory, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This function is available on Windows and Linux platforms <strong>only</strong>.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This function returns very different types depending on platform.</p>
|
||
</div>
|
||
<div class="ulist">
|
||
<ul>
|
||
<li><p>Linux: <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=linux#ExVirtualMemory" target="_blank" rel="noopener"><code>mem.ExVirtualMemory</code></a></p></li>
|
||
<li><p>Windows: <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=windows#ExVirtualMemory" target="_blank" rel="noopener"><code>mem.ExVirtualMemory</code></a></p></li>
|
||
</ul>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function wraps
|
||
|
||
`github.com/shirou/gopsutil/v4/mem.NewExLinux`
|
||
|
||
.[`VirtualMemory`](https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=linux#ExLinux.VirtualMemory) on Linux and
|
||
|
||
`github.com/shirou/gopsutil/v4/mem.NewExWindows`
|
||
|
||
.[`VirtualMemory`](https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=windows#ExWindows.VirtualMemory) on Windows.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_mem_swap" class="link">5.6.5.2. <code>psMemSwap</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psMemSwap() (swap *mem.SwapMemoryStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psMemSwap` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem#SwapMemory" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/mem.SwapMemory</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_mem_swapdevs" class="link">5.6.5.3. <code>psMemSwapDevs</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psMemSwapDevs() (swapDevs []*mem.SwapDevice, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psMemSwapDevs` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem#SwapDevices" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/mem.SwapDevices</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_mem_vmem" class="link">5.6.5.4. <code>psMemVMem</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psMemVMem() (vmem *mem.VirtualMemoryStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psMemVMem` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem#VirtualMemory" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/mem.VirtualMemory</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_net" class="link">5.6.6. Network</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_conns" class="link">5.6.6.1. <code>psNetConns</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetConns(kind string) (conns []net.ConnectionStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetConns` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#Connections" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Connections</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_connsmax" class="link">5.6.6.2. <code>psNetConnsMax</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetConnsMax(kind string, maxConn int) (conns []net.ConnectionStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetConnsMax` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConnectionsMax" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConnectionsMax</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_connspid" class="link">5.6.6.3. <code>psNetConnsPid</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetConnsPid(kind string, pid int32) (conns []net.ConnectionStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetConnsPid` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConnectionsPid" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConnectionsPid</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_connspidmax" class="link">5.6.6.4. <code>psNetConnsPidMax</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetConnsPidMax(kind string, pid int32, maxConn int) (conns []net.ConnectionStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetConnsPidMax` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConnectionsPidMax" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConnectionsPidMax</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_ct" class="link">5.6.6.5. <code>psNetCTStats</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetCTStats(percCpu bool) (ctStats []net.ConntrackStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetCTStats` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConntrackStats" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConntrackStats</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_ctlist" class="link">5.6.6.6. <code>psNetCTStatList</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetCTStatList() (ctStats *net.ConntrackStatList, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetCTStatList` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConntrackStatList" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConntrackStatList</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_fltcnt" class="link">5.6.6.7. <code>psNetFilterCnts</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetFilterCnts() (filterCnts []net.FilterStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetFilterCnts` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#FilterCounters" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.FilterCounters</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_iocnts" class="link">5.6.6.8. <code>psNetIoCnts</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetIoCnts(perNIC bool) (ioCnts []net.IOCountersStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetIoCnts` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#IOCounters" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.IOCounters</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_iocntsfl" class="link">5.6.6.9. <code>psNetIoCntsFile</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetIoCntsFile(perNIC bool, filepath string) (ioCnts []net.IOCountersStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetIoCntsFile` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#IOCountersByFile" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.IOCountersByFile</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_ifaces" class="link">5.6.6.10. <code>psNetIfaces</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetIfaces() (ioCnts []net.InterfaceStatList, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetIfaces` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#Interfaces" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Interfaces</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_pids" class="link">5.6.6.11. <code>psNetPids</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetPids() (pids []int32, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetPids` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#Pids" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Pids</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_protocnts" class="link">5.6.6.12. <code>psNetProtoCnt</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetProtoCnt(protos []string) (protoCnts []net.ProtoCountersStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This only works properly on Linux currently per upstream.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetProtoCnt` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ProtoCounters" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ProtoCounters</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_net_rev" class="link">5.6.6.13. <code>psNetRev</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psNetRev(b []byte) (out []byte)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This function only exists on Linux.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psNetRev` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net?GOOS=linux#Reverse" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Reverse</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_proc" class="link">5.6.7. Processes</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_procs_procs" class="link">5.6.7.1. <code>psProcs</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psProcs(pid int32) (procs []*process.Process, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psProcs` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#Processes" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.Processes</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_proc_new" class="link">5.6.7.2. <code>psProcNew</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psProcNew(pid int32) (proc *process.Process, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psProcNew` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#NewProcess" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.NewProcess</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_proc_pids" class="link">5.6.7.3. <code>psProcPids</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psProcPids() (pids []int32, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psProcPids` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#Pids" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.Pids</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_proc_pidxst" class="link">5.6.7.4. <code>psProcPidExists</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psProcPidExists(pid int32) (exists bool, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psProcPidExists` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#PidExists" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.PidExists</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_sns" class="link">5.6.8. Sensors/Thermals</a>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_sns_extemp" class="link">5.6.8.1. <code>psSensorExTemp</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psSensorExTemp() (temps []sensors.ExTemperature, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This function only exists on Linux.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psSensorExTemp` wraps
|
||
|
||
`github.com/shirou/gopsutil/v4/sensors.NewExLinux`
|
||
|
||
.[`github.com/shirou/gopsutil/v4/sensors.TemperatureWithContext`](https://pkg.go.dev/github.com/shirou/gopsutil/v4/sensors?GOOS=linux#TemperatureWithContext).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_sns_temps" class="link">5.6.8.2. <code>psSensorTemps</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psSensorTemps() (temps []sensors.TemperatureStat, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psSensorTemps` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/sensors#SensorsTemperatures" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/sensors.SensorsTemperatures</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_ps_winsvc" class="link">5.6.9. Windows Services</a>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>All of these functions are only available on Windows.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_winsvc_list" class="link">5.6.9.1. <code>psWinsvcList</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psWinsvcList() (svcs []winservices.Service, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This function is only available on Windows.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psWinsvcList` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/winservices?GOOS=windows#ListServices" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/winservices.ListServices</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_ps_winsvc_new" class="link">5.6.9.2. <code>psWinsvcNew</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func psWinsvcNew(svcName string) (svc *winservices.Service, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock warning">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Warning
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>This function is only available on Windows.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`psWinsvcNew` directly calls <a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/winservices?GOOS=windows#NewService" target="_blank" rel="noopener"><code>github.com/shirou/gopsutil/v4/winservices.NewService</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_str" class="link">5.7. Strings</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions use capabilities from:
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- [Standalone](#fn_str_stnd)
|
||
|
||
- [`r00t2.io/goutils/stringsx`](#fn_str_strsx)
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_str_stnd" class="link">5.7.1. Standalone</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These functions are standalone developed purely for this library. For legacy reasons, these have the special prefix `ext`.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_stnd_extindent" class="link">5.7.1.1. <code>extIndent</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func extIndent(
|
||
|
||
levels int,
|
||
|
||
skipFirst, skipEmpty, skipWhitespace bool,
|
||
|
||
indentString, input string,
|
||
|
||
) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`extIndent` allows for a MUCH more flexible indenter than the `sprig` `indent` function.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It works with both Windows (`\r\n`) and POSIX (`\n`) linebreaks.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>If <code><indentString></code> is set to <code>\n</code> and <code><levels></code> is always set to <code>1</code>, this function can even be used to doublespace text!</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It has quite a few arguments, however:
|
||
|
||
</div>
|
||
|
||
<table class="tableblock frame-all grid-all stretch" style="width:100%;">
|
||
<colgroup>
|
||
<col style="width: 16%" />
|
||
<col style="width: 16%" />
|
||
<col style="width: 66%" />
|
||
</colgroup>
|
||
<thead>
|
||
<tr>
|
||
<th class="tableblock halign-center valign-middle">Argument</th>
|
||
<th class="tableblock halign-center valign-middle">Type</th>
|
||
<th class="tableblock halign-left valign-middle">Description</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p><code>levels</code></p></td>
|
||
<td class="tableblock halign-center valign-middle"><p><code>int</code></p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="paragraph">
|
||
<p>The level of indentation for the text. If less than or equal to <code>0</code>, <code>extIndent</code> just returns <code><input></code> as-is and NO-OPs otherwise.</p>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p><code>skipFirst</code></p></td>
|
||
<td class="tableblock halign-center valign-middle"><p><code>bool</code></p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="paragraph">
|
||
<p>If true, skip indenting the first line. This is particularly handy if you like to visually align your function calls in your templates.</p>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p><code>skipEmpty</code></p></td>
|
||
<td class="tableblock halign-center valign-middle"><p><code>bool</code></p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="paragraph">
|
||
<p>If true, do not add an indent to <strong>empty</strong> lines (where an "empty line" means "only has a linebreak").</p>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p><code>skipWhitespace</code></p></td>
|
||
<td class="tableblock halign-center valign-middle"><p><code>bool</code></p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="paragraph">
|
||
<p>If true, do not add an indent to lines that <strong>only</strong> consist of whitespace (spaces, tabs, etc.) and a linebreak.</p>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p><code>indentString</code></p></td>
|
||
<td class="tableblock halign-center valign-middle"><p><code>string</code></p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="paragraph">
|
||
<p>The string to use as the "indent character". This can be any string, such as <code>"<SP>"</code> (<a href="https://asciiref.dev/#c32" target="_blank" rel="noopener"><code>0x20</code></a>), <code>"\t"</code>, <code>"."</code>, <code>"|"</code>, <code>"=="</code> etc.</p>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tableblock halign-center valign-middle"><p><code>input</code></p></td>
|
||
<td class="tableblock halign-center valign-middle"><p><code>string</code></p></td>
|
||
<td class="tableblock halign-left valign-middle"><div class="content">
|
||
<div class="paragraph">
|
||
<p>The text to be indented. Because it is the last argument, <code>extIndent</code> works with pipelined text as well.</p>
|
||
</div>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_str_strsx" class="link">5.7.2. <code>r00t2.io/goutils/stringsx</code></a>
|
||
|
||
<div class="paragraph">
|
||
|
||
These template functions contain capabilities from <a href="https://pkg.go.dev/r00t2.io/goutils/netx" target="_blank" rel="noopener"><code>r00t2.io/goutils/stringsx</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_isascii" class="link">5.7.2.1. <code>strsxIsAscii</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxIsAscii(s string, allowCtl, allowExt bool) (isAscii bool, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxIsAscii` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#IsAscii" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.IsAscii</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_isasciibuf" class="link">5.7.2.2. <code>strsxIsAsciiBuf</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxIsAsciiBuf(r io.RuneReader, allowCtl, allowExt bool) (isAscii bool, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxIsAsciiBuf` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#IsAsciiBuf" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.IsAsciiBuf</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_isasciispcl" class="link">5.7.2.3. <code>strsxIsAsciiSpcl</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxIsAsciiSpcl(
|
||
|
||
s string,
|
||
|
||
allowCtl, allowPrint, allowExt, allowWs bool,
|
||
|
||
incl, excl []byte
|
||
|
||
) (isAscii bool, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxIsAsciiSpcl` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#IsAsciiSpecial" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.IsAsciiSpecial</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_isasciibufspcl" class="link">5.7.2.4. <code>strsxIsAsciiBufSpcl</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxIsAsciiBufSpcl(
|
||
|
||
r io.RuneReader,
|
||
|
||
allowCtl, allowPrint, allowExt, allowWs bool,
|
||
|
||
incl, excl []byte
|
||
|
||
) (isAscii bool, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxIsAsciiBufSpcl` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#IsAsciiSpecial" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.IsAsciiSpecial</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_lenspl" class="link">5.7.2.5. <code>strsxLenSpl</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxLenSpl(s string, width uint) (out []string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxLenSpl` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#LenSplit" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.LenSplit</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_lensplstr" class="link">5.7.2.6. <code>strsxLenSplStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxLenSplStr(s string, width uint, winNewline bool) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxLenSplStr` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#LenSplitStr" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.LenSplitStr</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_pad" class="link">5.7.2.7. <code>strsxPad</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxPad(s []string, width uint, pad string, leftPad bool) (out []string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxPad` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#Pad" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.Pad</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_rdct" class="link">5.7.2.8. <code>strsxRedact</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxRedact(s, maskStr string, leading, trailing uint, newlines bool) (redacted string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxRedact` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#Redact" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.Redact</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_rev" class="link">5.7.2.9. <code>strsxRev</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxRev(s string) (revS string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxRev` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#Reverse" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.Reverse</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_trimlns" class="link">5.7.2.10. <code>strsxTrimLns</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxTrimLns(s string, left, right bool) (trimmed string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxTrimLns` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#TrimLines" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.TrimLines</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_trimspcl" class="link">5.7.2.11. <code>strsxTrimSpcLft</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxTrimSpcLft(s string) (trimmed string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxTrimSpcLft` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#TrimSpaceLeft" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.TrimSpaceLeft</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect4">
|
||
|
||
##### <a href="#fn_str_strsx_trimspcr" class="link">5.7.2.12. <code>strsxTrimSpcRt</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func strsxTrimSpcRt(s string) (trimmed string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`strsxTrimSpcRt` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx/stringsx#TrimSpaceRight" target="_blank" rel="noopener"><code>r00t2.io/goutils/tplx/sprigx/stringsx.TrimSpaceRight</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_sys" class="link">5.8. System/Platform/Architecture</a>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_sys_arch" class="link">5.8.1. <code>sysArch</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func sysArch() (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Returns the <a href="https://pkg.go.dev/runtime#GOARCH" target="_blank" rel="noopener"><code>runtime.GOARCH</code></a> constant.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_sys_numcpu" class="link">5.8.2. <code>sysNumCpu</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func sysNumCpu() (cnt int)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`sysNumCpu` directly calls <a href="https://pkg.go.dev/runtime#NumCPU" target="_blank" rel="noopener"><code>runtime.NumCPU</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_sys_os" class="link">5.8.3. <code>sysOsName</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func sysOsName() (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Returns the <a href="https://pkg.go.dev/runtime#GOOS" target="_blank" rel="noopener"><code>runtime.GOOS</code></a> constant.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_sys_rntm" class="link">5.8.4. <code>sysRuntime</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func sysRuntime() (out map[string]string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This function returns a `map[string]string` of various information from the <a href="https://pkg.go.dev/runtime" target="_blank" rel="noopener"><code>runtime</code> stdlib library</a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Specifically, the following are returned.
|
||
|
||
</div>
|
||
|
||
<div class="admonitionblock tip">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Tip
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>The value type is a direct link to the <code>runtime</code> documentation providing more detail about the associated value.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Because all values are mapped as strings, they can be converted back to their native type via e.g. the <a href="https://masterminds.github.io/sprig/conversion.html" target="_blank" rel="noopener">Sprig conversion functions</a> if necessary.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
| Key | Value Type |
|
||
|----|----|
|
||
| `compiler` | <a href="https://pkg.go.dev/runtime#Compiler" target="_blank" rel="noopener">string</a> |
|
||
| `arch` | <a href="https://pkg.go.dev/runtime#GOARCH" target="_blank" rel="noopener">string</a> |
|
||
| `os` | <a href="https://pkg.go.dev/runtime#GOOS" target="_blank" rel="noopener">string</a> |
|
||
| `maxprocs` | <a href="https://pkg.go.dev/runtime#GOMAXPROCS" target="_blank" rel="noopener">int</a> <sup>\[<a href="#_footnotedef_1" id="_footnoteref_1" class="footnote" title="View footnote.">1</a>\]</sup> |
|
||
| `cpu_cnt` | <a href="https://pkg.go.dev/runtime#NumCPU" target="_blank" rel="noopener">int</a> |
|
||
| `num_cgo` | <a href="https://pkg.go.dev/runtime#NumCgoCall" target="_blank" rel="noopener">int</a> |
|
||
| `num_go` | <a href="https://pkg.go.dev/runtime#NumGoroutine" target="_blank" rel="noopener">int</a> |
|
||
| `go_ver` | <a href="https://pkg.go.dev/runtime#Version" target="_blank" rel="noopener">string</a> |
|
||
|
||
Table 1. `sysRuntime` Values
|
||
|
||
<div class="paragraph">
|
||
|
||
As a convenience, some of these values also have their own dedicated functions as well:
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- [`sysArch`](#fn_sys_arch)
|
||
|
||
- [`sysNumCpu`](#fn_sys_numcpu)
|
||
|
||
- [`sysOsName`](#fn_sys_os)
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#fn_tm" class="link">5.9. Time/Dates/Timestamps</a>
|
||
|
||
<div class="admonitionblock note">
|
||
|
||
<table>
|
||
<colgroup>
|
||
<col style="width: 50%" />
|
||
<col style="width: 50%" />
|
||
</colgroup>
|
||
<tbody>
|
||
<tr>
|
||
<td class="icon"><div class="title">
|
||
Note
|
||
</div></td>
|
||
<td class="content"><div class="paragraph">
|
||
<p>Some of these functions duplicate Sprig functionality, but are included here for predictable API.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Care has been taken to name these functions differently from the Sprig functions where possible and sensible.</p>
|
||
</div></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_date" class="link">5.9.1. <code>tmDate</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmDate(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) (date time.Time)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmDate` directly calls <a href="https://pkg.go.dev/time#Date" target="_blank" rel="noopener"><code>time.Date</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_fltmic" class="link">5.9.2. <code>tmFloatMicro</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmFloatMicro(t time.Time) (f64 float64)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmFloatMicro` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Microseconds" target="_blank" rel="noopener"><code>(r00t2.io/goutils/timex).F64Microseconds</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_fltmill" class="link">5.9.3. <code>tmFloatMilli</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmFloatMilli(t time.Time) (f64 float64)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmFloatMilli` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Milliseconds" target="_blank" rel="noopener"><code>(r00t2.io/goutils/timex).F64Milliseconds</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_fltnano" class="link">5.9.4. <code>tmFloatNano</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmFloatNano(t time.Time) (f64 float64)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmFloatNano` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Nanoseconds" target="_blank" rel="noopener"><code>(r00t2.io/goutils/timex).F64Nanoseconds</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_flt" class="link">5.9.5. <code>tmFloat</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmFloat(t time.Time) (f64 float64)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmFloat` directly calls <a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Seconds" target="_blank" rel="noopener"><code>(r00t2.io/goutils/timex).F64Seconds</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_fmt" class="link">5.9.6. <code>tmFmt</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmFmt(fstr string, t time.Time) (out string)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmFormat` provides a more pipeline-friendly alternative to calling e.g.
|
||
|
||
</div>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
{{- $t := tmNow -}}
|
||
{{ $t.Format "<some time format string>" }}
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_now" class="link">5.9.7. <code>tmNow</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmNow() (now time.Time)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmNow` directly calls <a href="https://pkg.go.dev/time#Now" target="_blank" rel="noopener"><code>time.Now</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_pdur8n" class="link">5.9.8. <code>tmParseDur8n</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmParseDur8n(s string) (d time.Duration, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmParseDur8n` directly calls <a href="https://pkg.go.dev/time#ParseDuration" target="_blank" rel="noopener"><code>time.ParseDuration</code></a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_pmnth" class="link">5.9.9. <code>tmParseMonth</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmParseMonth(v any) (mon time.Month, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmParseMonth` attempts to first try [`tmParseMonthInt`](#fn_tm_pmnthi) and then tries [`tmParseMonthStr`](#fn_tm_pmnths) if `v` is not "numeric".
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_pmnthi" class="link">5.9.10. <code>tmParseMonthInt</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmParseMonthInt(n any) (mon time.Month, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmParseMonthInt` parses a number representation of month `n` to a <a href="https://pkg.go.dev/time#Month" target="_blank" rel="noopener"><code>time.Month</code></a>. `n` may be any numeric type or a string representation of a number (or a custom type derived from those).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
A negative integer (or float, etc.) will be converted to a positive one (e.g. `-6` → `6` → `time.June`).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Floats are rounded to the nearest integer.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
The integer should map directly to the <a href="https://pkg.go.dev/time#example-Month" target="_blank" rel="noopener"><code>time.Month</code> constants</a> in the `time` module:
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- `1`: `time.January`
|
||
|
||
- `2`: `time.February`
|
||
|
||
- `3`: `time.March`
|
||
|
||
- `4`: `time.April`
|
||
|
||
- `5`: `time.May`
|
||
|
||
- `6`: `time.June`
|
||
|
||
- `7`: `time.July`
|
||
|
||
- `8`: `time.August`
|
||
|
||
- `9`: `time.September`
|
||
|
||
- `10`: `time.October`
|
||
|
||
- `11`: `time.November`
|
||
|
||
- `12`: `time.December`
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
If `n` resolves to `0`, `mon` will be the current month (as determined by <a href="https://pkg.go.dev/time#Now" target="_blank" rel="noopener"><code>time.Now</code></a>).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
If `n` resolves to \> `12`, `err` will be `sprigx.ErrBadMonth` (though be sure to use <a href="https://pkg.go.dev/errors#Is" target="_blank" rel="noopener"><code>errors.Is</code></a>; it will be wrapped by [`(text/template).ExecError`](https://pkg.go.dev/text/template#ExecError)/[`(html/template).ExecError`](https://pkg.go.dev/html/template#ExecError).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_pmnths" class="link">5.9.11. <code>tmParseMonthStr</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmParseMonthStr(s string) (mon time.Month, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmParseMonthStr` parses a string representation `s` of a month to a <a href="https://pkg.go.dev/time#Month" target="_blank" rel="noopener"><code>time.Month</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
It normalizes `s` to lowercase and only uses the first 3 characters (the minimum length needed to determine month name uniqueness - "June" vs. "July", "March" vs. "May").
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
An empty (or whitespace-only) string will use the current month (as determined by <a href="https://pkg.go.dev/time#Now" target="_blank" rel="noopener"><code>time.Now</code></a>).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#fn_tm_ptm" class="link">5.9.12. <code>tmParseTime</code></a>
|
||
|
||
<div class="listingblock">
|
||
|
||
<div class="title">
|
||
|
||
Function Signature
|
||
|
||
</div>
|
||
|
||
<div class="content">
|
||
|
||
``` rouge
|
||
func tmParseTime(layout, value string) (t time.Time, err error)
|
||
```
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
`tmParseTime` directly calls <a href="https://pkg.go.dev/time#Parse" target="_blank" rel="noopener"><code>time.Parse</code></a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Be sure that `layout` is a properly parseable <a href="https://pkg.go.dev/time#Layout" target="_blank" rel="noopener">layout format</a>.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect1">
|
||
|
||
## <a href="#todo" class="link">6. TODO/Wishlist</a>
|
||
|
||
<div class="sectionbody">
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_collctns" class="link">6.1. Function Collections</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Functions should be split into more granular function maps that allows a conusmer to only load a certain subset of relevant functions to reduce surface - string functions, network functions, etc.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
This would ideally also allow for e.g. FuncMap "generators" that would return a FuncMap of methods bound to a struct with certain contextual settings (e.g. a root path restriction for [Extend OS functions](#todo_os)).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_fallible" class="link">6.2. Fallibility</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Requires [Function Collections](#todo_collctns) first.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Modeled after Vector’s VRL concept of <a href="https://vector.dev/docs/reference/vrl/#fallibility" target="_blank" rel="noopener"><em>Fallibility</em></a> (<a href="https://vector.dev/docs/reference/vrl/expressions/#function-fallibility" target="_blank" rel="noopener">see also</a>).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Functions should be grouped/selectable by "fallibility" - if they are guaranteed to return a **meaningful** value always, if they are guaranteed to return a value that **may be empty** but no error will be returned, or if a function **may** return an error.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_safe" class="link">6.3. Function Scope Segregation</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Requires [Function Collections](#todo_collctns) first.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Modeled (slightly) after Vector’s VRL concept of <a href="https://vector.dev/docs/reference/vrl/expressions/#purity" target="_blank" rel="noopener">purity</a>.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
As more functions get added (and even with the present function set), it may be desired that only functions that work only with provided data are exposed to templates.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
The goal is to scope/separate functions in such a way that they are "tagged" with multiple attributes/characteristics:
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- [Fallibility](#todo_fallible)
|
||
|
||
- External Read (e.g. [reading arbitrary files](#todo_os_fs))
|
||
|
||
- Internal Modify (would potentially transform source data/data structures)
|
||
|
||
- External Modify (would affect the invoking system, e.g. [\[todo_os_fs\]](#todo_os_fs))
|
||
|
||
- Arbitrary Execution (e.g. `osExec` — see [\[todo_os_fs\]](#todo_os_fs))
|
||
|
||
- Network Access (e.g. would involve creating network connections instead of operating on provided data locally)
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
A risk "score" from 1-10 should also be implemented with the above scopes/classes for further/alternative filtering by consumers.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_os" class="link">6.4. Extend OS functions</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Requires [Function Scope Segregation](#todo_safe) first. (Not technically, but can provide a pretty big risk of not split out first.)
|
||
|
||
</div>
|
||
|
||
<div id="todo_os_fs" class="paragraph">
|
||
|
||
Adding the ability to read files from the filesystem should be added. As part of this, however, a package-level variable should be implemented (or [Function Collections](#todo_collctns)) that can restrict reading to a specific prefix.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Off the top of my head:
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- `osReadFile`
|
||
|
||
<div class="ulist">
|
||
|
||
- Returns an `*os.File`.
|
||
|
||
- Closing the handler gets tricky, though… it can be done from within the template, but templates also have no `defer` to my knowledge. Caveat emptor.
|
||
|
||
</div>
|
||
|
||
- `osReadFileBuf`
|
||
|
||
<div class="ulist">
|
||
|
||
- Will return a `*bytes.Buffer` with the contents of a file.
|
||
|
||
- A little safer than `osReadFile` as it’s backed by a static set of bytes and doesn’t need to be `.Close()`'d.
|
||
|
||
</div>
|
||
|
||
- `osReadFileBytes`
|
||
|
||
<div class="ulist">
|
||
|
||
- Should include an optional length limiter, so data from e.g. `/dev/urandom` can be read from.
|
||
|
||
</div>
|
||
|
||
- `osReadFileStr`
|
||
|
||
<div class="ulist">
|
||
|
||
- Would return `string` instead of `[]byte`.
|
||
|
||
</div>
|
||
|
||
- `osReadDir`
|
||
|
||
<div class="ulist">
|
||
|
||
- Returns a `[]fs.DirEntry` of a given path via `os.ReadDir`.
|
||
|
||
</div>
|
||
|
||
- `osStat`
|
||
|
||
<div class="ulist">
|
||
|
||
- Returns an `fs.FileInfo` from an `os.Stat` or `os.LStat` (controlled by tpl function parameter)
|
||
|
||
</div>
|
||
|
||
- `osExec`
|
||
|
||
<div class="ulist">
|
||
|
||
- Exactly what you’d think. Returns a command via an `os/exec.Cmd`, with params passed to `os/exec.Command` (plus `*bytes.Buffer`s set to `<exec.Cmd>.Stdin` and `<exec.Cmd>.Stdout`).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
These obviously have the potential to be **incredibly** dangerous if using untrusted template strings.
|
||
|
||
</div>
|
||
|
||
<div class="sect3">
|
||
|
||
#### <a href="#todo_os_env" class="link">6.4.1. Environment Variables</a>
|
||
|
||
<div class="ulist">
|
||
|
||
- `osEnvGet` (`os.Getenv`)
|
||
|
||
- `osEnvs` (returns `os.Environ` result)
|
||
|
||
- `osEnvsMap` and other <a href="https://pkg.go.dev/r00t2.io/sysutils/envs" target="_blank" rel="noopener"><code>r00t2.io/sysutils/envs</code></a> funcs
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_sys" class="link">6.5. System Functions</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
This would be… particularly tricky.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
I essentially want to expose a large amount of functionality from <a href="https://pkg.go.dev/golang.org/x/sys/unix" target="_blank" rel="noopener"><code>golang.org/x/sys/unix</code></a> and <a href="https://pkg.go.dev/golang.org/x/sys@v0.46.0/windows" target="_blank" rel="noopener"><code>golang.org/x/sys/windows</code></a> (and its <a href="https://pkg.go.dev/golang.org/x/sys@v0.46.0/windows#section-directories" target="_blank" rel="noopener">subpackages</a>).
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
At the least I should have a way to (attempt to) convert/coerce an `fs.FileInfo.Sys()` into the platform-appropriate definite object (e.g. a <a href="https://pkg.go.dev/golang.org/x/sys/unix#Stat_t" target="_blank" rel="noopener"><code>golang.org/x/sys/unix.Stat_t</code></a> and/or <a href="https://pkg.go.dev/golang.org/x/sys/unix#Statx_t" target="_blank" rel="noopener"><code>golang.org/x/sys/unix.Statx_t</code></a>, or a <a href="https://pkg.go.dev/golang.org/x/sys/windows#Win32FileAttributeData" target="_blank" rel="noopener"><code>golang.org/x/sys/windows.Win32FileAttributeData</code></a>).
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_encode" class="link">6.6. Encoding Functions</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Should require [Function Collections](#todo_collctns) first (at least for grouping).
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- `hex*` functions (<a href="https://pkg.go.dev/encoding/hex" target="_blank" rel="noopener"><code>encoding/hex</code></a>)
|
||
|
||
<div class="ulist">
|
||
|
||
- Technically hex is "base16"
|
||
|
||
</div>
|
||
|
||
- `hexx*` functions (<a href="https://pkg.go.dev/r00t2.io/goutils/encodingx/hexx" target="_blank" rel="noopener"><code>r00t2.io/goutils/encodingx/hexx</code></a>)
|
||
|
||
- `b64*` functions (<a href="https://pkg.go.dev/encoding/base64" target="_blank" rel="noopener"><code>encoding/base64</code></a>)
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_uuid" class="link">6.7. UUID Functions</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Should require [Function Collections](#todo_collctns) first (at least for grouping).
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- `uuid*` functions for <a href="https://pkg.go.dev/github.com/google/uuid" target="_blank" rel="noopener"><code>github.com/google/uuid</code></a>
|
||
|
||
- `uuidx*` functions for <a href="https://pkg.go.dev/r00t2.io/goutils/uuidx" target="_blank" rel="noopener"><code>r00t2.io/goutils/uuidx</code></a>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_url" class="link">6.8. URL Functions</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Expose <a href="https://pkg.go.devnet/url/" target="_blank" rel="noopener"><code>net/url</code></a> functions to derive URLs.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="sect2">
|
||
|
||
### <a href="#todo_net" class="link">6.9. Live Networking Functions</a>
|
||
|
||
<div class="paragraph">
|
||
|
||
Requires [Function Scope Segregation](#todo_safe) first.
|
||
|
||
</div>
|
||
|
||
<div class="paragraph">
|
||
|
||
Sometimes networking data lookup is needed at time of render/contextual to render.
|
||
|
||
</div>
|
||
|
||
<div class="ulist">
|
||
|
||
- `dns*` (DNS lookup options from <a href="https://pkg.go.dev/" target="_blank" rel="noopener"><code>net</code></a>)
|
||
|
||
<div class="ulist">
|
||
|
||
- With the ability to use a custom resolver (would need [Function Collections](#todo_collctns))
|
||
|
||
</div>
|
||
|
||
- `http*` functions
|
||
|
||
<div class="ulist">
|
||
|
||
- `httpReq` for a <a href="https://pkg.go.dev/net/http#Request" target="_blank" rel="noopener"><code>net/http.Request</code></a>
|
||
|
||
- `http<Method>` for a shorthand/one-shot version of `httpReq` above
|
||
|
||
- `resty*` functions for <a href="https://pkg.go.dev/resty.dev/v3" target="_blank" rel="noopener"><code>resty.dev/v3</code></a>?
|
||
|
||
<div class="ulist">
|
||
|
||
- Maybe via a configured [Function Collections](#todo_collctns) instead
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="footnotes">
|
||
|
||
------------------------------------------------------------------------
|
||
|
||
<div id="_footnotedef_1" class="footnote">
|
||
|
||
[1](#_footnoteref_1). For safety concerns, `sprigx` does not allow **setting** `GOMAXPROCS`, this value only contains the **current** `GOMAXPROCS` value.
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="footer">
|
||
|
||
<div id="footer-text">
|
||
|
||
Last updated 2026-06-11 16:25:00 -0400
|
||
|
||
</div>
|
||
|
||
</div>
|