[Go] Get the network interface for the external access

func GetExternalInterface() string {
	route := ""

	res := exec.Command("ip", []string{"route"}...)
	if out, err := res.Output(); err == nil {
		route = string(out)
	}

	routeData := strings.Split(strings.Split(route, "\n")[0], " ")

	for idx, word := range routeData {
		if word == "dev" {
			return routeData[idx+1]
		}
	}

	return ""
}