func GetLocalIP() (string, error) {
	ifaces, err := net.Interfaces()
	if err != nil {
		return "", err
	}
	for _, iface := range ifaces {
		addrs, err := iface.Addrs()
		if err != nil {
			return "", err
		}
		for _, addr := range addrs {
			var ip net.IP
			switch v := addr.(type) {
			case *net.IPNet:
				ip = v.IP
			case *net.IPAddr:
				ip = v.IP
			}
			if ip == nil || ip.IsLoopback() {
				continue
			}
			ip = ip.To4()
			if ip == nil {
				continue  
			}
			return ip.String(), nil
		}
	}
	return "", ErrInvalidLocalIP
}
GetLocalIP attempts to figure out a valid IP address for this machine.
package helpers
import (
	"bytes"
	"encoding/base64"
	"encoding/json"
	"errors"
	"net"
	"net/http"
	"github.com/nymtech/nym-directory/models"
	"github.com/nymtech/nym-mixnet/config"
	"github.com/nymtech/nym-mixnet/sphinx"
)
var (
	ErrInvalidLocalIP = errors.New("couldn't find a valid IP for your machine, check your internet connection")
)
func ResolveTCPAddress(host, port string) (*net.TCPAddr, error) {
	addr, err := net.ResolveTCPAddr("tcp", host+":"+port)
	if err != nil {
		return nil, err
	}
	return addr, nil
}