geo

package module
v0.0.0-...-6336f89 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 14 Imported by: 0

README

geo

CoreDNS GeoDNS Plugin

Documentation

Overview

https://gist.github.com/cdipaolo/d3f8db3848278b49db68

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(lat1, lon1, lat2, lon2 float64) float64

Distance function returns the distance (in meters) between two points of

a given longitude and latitude relatively accurately (using a spherical
approximation of the Earth) through the Haversin Distance Formula for
great arc distance on a sphere with accuracy for small distances

point coordinates are supplied in degrees and converted into rad. in the func

distance returned is METERS!!!!!! http://en.wikipedia.org/wiki/Haversine_formula

Types

type Geo

type Geo struct {
	Next plugin.Handler
	Fall fall.F

	IP2Location  *ip2location.DB
	Zone         map[string][]GeoType
	ZoneFilename string
}

func (Geo) Name

func (g Geo) Name() string

Name implements the Handler interface.

func (Geo) ServeDNS

func (g Geo) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type GeoFile

type GeoFile struct {
	Zone  string  `yaml:"zone"`
	TTL   uint32  `yaml:"ttl"`
	Type  string  `yaml:"type"`
	Value string  `yaml:"value"`
	Lat   float64 `yaml:"lat"`
	Lon   float64 `yaml:"lon"`
}

type GeoType

type GeoType struct {
	Type  uint16  `yaml:"type"`
	TTL   uint32  `yaml:"ttl"`
	Value string  `yaml:"value"`
	Lat   float64 `yaml:"lat"`
	Lon   float64 `yaml:"lon"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL