listener.go
func getNaiveExternalAddress(port int) *NetAddress {
	addrs, err := net.InterfaceAddrs()
	if err != nil {
		PanicCrisis(Fmt("Could not fetch interface addresses: %v", err))
	}

	for _, a := range addrs {
		ipnet, ok := a.(*net.IPNet)
		if !ok {
			continue
		}
		v4 := ipnet.IP.To4()
		if v4 == nil || v4[0] == 127 {
			continue
		} // loopback
		return NewNetAddressIPPort(ipnet.IP, uint16(port))
	}
	return nil
}
func getNaiveExternalAddress(port int) *NetAddress {
	addrs, err := net.InterfaceAddrs()
	if err != nil {
		PanicCrisis(Fmt("Could not fetch interface addresses: %v", err))
	}

	for _, a := range addrs {
		ipnet, ok := a.(*net.IPNet)
		if !ok {
			continue
		}
		v4 := ipnet.IP.To4()
		if v4 == nil || v4[0] == 127 {
			continue
		} // loopback
		return NewNetAddressIPPort(ipnet.IP, uint16(port))
	}
	return nil
}
func getNaiveExternalAddress ( port int ) * NetAddress { addrs , err := net . InterfaceAddrs ( ) if err != nil { PanicCrisis ( Fmt ( " " , err ) ) } for _ , a := range addrs { ipnet , ok := a . ( * net . IPNet ) if ! ok { continue } v4 := ipnet . IP . To4 ( ) if v4 == nil || v4 [ 0 ] == 127 { continue } // loopback return NewNetAddressIPPort ( ipnet . IP , uint16 ( port ) ) } return nil }
// TODO: use syscalls: http://pastebin.com/9exZG4rh
TODO : use syscalls : http : // pastebin . com / 9exZG4rh