resolver

package
v0.0.0-...-0b7e9c5 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventResolver

type EventResolver interface {
	ResolveEvent(event api.Event) ([]int64, error)
	Resolve(addr string) (int64, error)
	MarkRemoteEvent(id int64, geoID int64) error
	MarkOriginEvent(id int64, geoID int64) error
}

EventResolver interface

type Geo

type Geo struct {
	ID          int64     `db:"id" json:"id"`
	IP          string    `db:"ip" json:"ip"`
	LastUpdate  time.Time `db:"last_update" json:"last_update"`
	CountryCode string    `db:"country_code" json:"country_code"`
	RegionCode  string    `db:"region_code" json:"region_code"`
	RegionName  string    `db:"region_name" json:"region_name"`
	City        string    `db:"city" json:"city"`
	TimeZone    string    `db:"time_zone" json:"time_zone"`
	Latitude    float64   `db:"latitude" json:"latitude"`
	Longitude   float64   `db:"longitude" json:"longitude"`
	MetroCode   uint      `db:"metro_code" json:"metro_code"`
}

Geo location of addr

func (Geo) String

func (g Geo) String() string

type GeoClient

type GeoClient struct {
	URL string
}

GeoClient for geo IP

func (*GeoClient) GetLocationForAddr

func (c *GeoClient) GetLocationForAddr(ip string) (*Geo, error)

type GeoClientTransporter

type GeoClientTransporter interface {
	GetLocationForAddr(ip string) (*Geo, error)
}

type ResolveClient

type ResolveClient struct {
	// contains filtered or unexported fields
}

func NewResolveClient

func NewResolveClient(options ...ResolveOptionFunc) (*ResolveClient, error)

func (*ResolveClient) MarkOriginEvent

func (c *ResolveClient) MarkOriginEvent(id int64, geoID int64) error

func (*ResolveClient) MarkRemoteEvent

func (c *ResolveClient) MarkRemoteEvent(id int64, geoID int64) error

func (*ResolveClient) Resolve

func (c *ResolveClient) Resolve(addr string) (int64, error)

func (*ResolveClient) ResolveEvent

func (c *ResolveClient) ResolveEvent(event api.Event) ([]int64, error)

type ResolveOptionFunc

type ResolveOptionFunc func(*ResolveClient) error

func SetDb

func SetDb(db potdb.DB) ResolveOptionFunc

func UseCache

func UseCache() ResolveOptionFunc

Jump to

Keyboard shortcuts

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