You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: location.go
    path of file: ./repos/portmaster/netenv
    
    the code of the file until where you have to start completion: package netenv

import (
	"errors"
	"fmt"
	"net"
	"sort"
	"sync"
	"time"

	"github.com/google/gopacket/layers"
	"golang.org/x/net/icmp"
	"golang.org/x/net/ipv4"

	"github.com/safing/portbase/log"
	"github.com/safing/portbase/rng"
	"github.com/safing/portmaster/intel/geoip"
	"github.com/safing/portmaster/network/netutils"
	"github.com/safing/portmaster/network/packet"
)

var (
	// locationTestingIPv4 holds the IP address of the server that should be
	// tracerout
    
func getLocationFromInterfaces(dls *DeviceLocations) (v4ok, v6ok bool) {
	globalIPv4, globalIPv6, err := GetAssignedGlobalAddresses()
	if err != nil {
		log.Warningf("netenv: location: failed to get assigned global addresses: %s", err)
		return false, false
	}
	for _, ip := range globalIPv4 {
		if _, ok := dls.AddIP(ip, SourceInterface); ok {
			v4ok = true
		}
	}
	for _, ip := range globalIPv6 {
		if _, ok := dls.AddIP(ip, SourceInterface); ok {
			v6ok = true
		}
	}

	return
}