Skip to content

iesreza/netconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Oct 20, 2019
48f43d5 · Oct 20, 2019

History

25 Commits
Oct 20, 2019
May 10, 2019
May 11, 2019
Oct 20, 2019
Oct 20, 2019

Repository files navigation

netconfig

Golang Network configuration reader read cross platform network configuration

Currently can read

  • InterfaceName
  • HardwareAddress
  • LocalIP
  • DNS
  • SubnetMask
  • DefaultGateway
  • Suffix

Example

package main

import (
	"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)

}

Releases

No releases published

Packages

No packages published

Languages