Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iesreza/netconfig
Golang Network Configuration Reader
https://github.com/iesreza/netconfig
go golang netconfig network network-monitoring
Last synced: 14 days ago
JSON representation
Golang Network Configuration Reader
- Host: GitHub
- URL: https://github.com/iesreza/netconfig
- Owner: iesreza
- License: gpl-3.0
- Created: 2019-05-10T15:38:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-20T11:20:01.000Z (about 5 years ago)
- Last Synced: 2024-06-20T10:22:36.990Z (7 months ago)
- Topics: go, golang, netconfig, network, network-monitoring
- Language: Go
- Size: 42 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# netconfig
Golang Network configuration reader
read cross platform network configuration### Currently can read
- InterfaceName
- HardwareAddress
- LocalIP
- DNS
- SubnetMask
- DefaultGateway
- Suffix## Example
```
package mainimport (
"fmt"
"github.com/iesreza/netconfig"
"strings"
)func main() {
network := netconfig.GetNetworkConfig()res := "InterfaceName:"+network.InterfaceName+"\r\n"
res += "HardwareAddress:"+network.HardwareAddress.String()+"\r\n"
res += "LocalIP:"+network.LocalIP.String()+"\r\n"
res += "DNS:"+strings.Join(network.DNS,",")+"\r\n"
res += "SubnetMask:"+network.SubnetMask.String()+"\r\n"
res += "DefaultGateway:"+network.DefaultGateway.String()+"\r\n"
res += "Suffix:"+network.Suffix+"\r\n"fmt.Println(res)
}
```