package
Version:
v0.0.0-...-5616126
Opens a new window with list of versions in this module.
Published: Jun 11, 2025
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Net Utils
- provide some network utils. eg:
InternalIPv4
- sub package:
httpctypes - provide some commonly http content types.
httpheader - provide some commonly http header names.
httpreq - provide some http request utils
Install
go get github.com/maintell/goutil/netutil
Go docs
Usage
import "github.com/maintell/goutil/netutil"
// Get internal IPv4 address
netutil.InternalIPv4()
Testings
go test -v ./netutil/...
Test limit by regexp:
go test -v -run ^TestSetByKeys ./netutil/...
Documentation
¶
Package netutil provide some network util functions.
FreePort returns a free port.
func GetLocalIPs() (ips []string)
GetLocalIPs get local IPs, will panic if error.
HostIP returns the IP addresses of the localhost.
IPv4 get internal IPv4 for host.
InternalIP get internal IP for host.
func InternalIPv1() (ip string)
InternalIPv1 get internal IP buy old logic
InternalIPv4 get internal IPv4 for host.
InternalIPv6 get internal IPv6
Source Files
¶
Directories
¶
Package httpctype list some common http content-type
|
Package httpctype list some common http content-type |
Package httpheader provides some common http header names.
|
Package httpheader provides some common http header names. |
Package httpreq provide an simple http requester and some useful util functions.
|
Package httpreq provide an simple http requester and some useful util functions. |
Click to show internal directories.
Click to hide internal directories.