stats

package
v0.0.0-...-b5a4b96 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2016 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package stats contains method to collect and return info about activities.

It uses https://docs.mongodb.org/v3.0/reference/operator/aggregation-date/ to collect different info about requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Callback

func Callback(ctx context.Context, cu *trim.CustomURL) error

Callback is a callback handler. It does HTTP request if it's needed.

func Tracker

func Tracker(ctx context.Context, cu *trim.CustomURL, addr string) error

Tracker saves info about short URL activities. GeoIP database can be loaded from http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz

Types

type GeoData

type GeoData struct {
	IP        string  `bson:"ip"`
	Country   string  `bson:"country"`
	City      string  `bson:"city"`
	Tz        string  `bson:"tz"`
	Latitude  float64 `bson:"lat"`
	Longitude float64 `bson:"lon"`
}

GeoData is geographic information.

type Track

type Track struct {
	ID      bson.ObjectId `bson:"_id"`
	Short   string        `bson:"short"`
	URL     string        `bson:"url"`
	Group   string        `bson:"group"`
	Tag     string        `bson:"tag"`
	Geo     GeoData       `bson:"geo"`
	Created time.Time     `bson:"ts"`
}

Track is information about users requests.

Jump to

Keyboard shortcuts

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