api

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BatchEventsURL = "/v1/event/batch"

BatchEventsURL post batch events

View Source
const EventCountryStatsURL = "/v1/event/stats/country"

EventCountryStatsURL stats per country

View Source
const EventURL = "/v1/event"

EventURL post single event

View Source
const StreamURL = "/v1/event/stream"

StreamURL websockets

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchEventResponse

type BatchEventResponse struct {
	Duration time.Duration `json:"duration"`
	Rows     int64         `json:"rows"`
	LastID   int64         `json:"lastId"`
}

BatchEventResponse response for batch inserts

type CountryStat

type CountryStat struct {
	Country   string
	Latitude  float64
	Longitude float64
	Hits      int64
}

CountryStat stats on cc

type Event

type Event struct {
	ID            int64     `json:"id"`
	Time          EventTime `json:"time"`
	User          string    `json:"user"`
	Passwd        string    `json:"passwd"`
	RemoteAddr    string    `json:"remoteAddr"`
	RemoteGeoID   int64     `json:"remoteGeoId"`
	RemotePort    int       `json:"remotePort"`
	RemoteName    string    `json:"remoteName"`
	RemoteVersion string    `json:"remoteVersion"`
	OriginAddr    string    `json:"originAddr"`
	OriginGeoID   int64     `json:"originGeoId"`
	Application   string    `json:"application"`
	Protocol      string    `json:"protocol"`
}

Event to record

func (Event) String

func (e Event) String() string

type EventClient

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

EventClient hods the endpoint url

func New

func New(server string, options ...func(*EventClient) error) (*EventClient, error)

New client for API

func (*EventClient) GetCountryStats

func (e *EventClient) GetCountryStats() ([]CountryStat, error)

GetCountryStats country stats

func (*EventClient) GetEvent

func (e *EventClient) GetEvent(id int64) (*EventGeo, error)

GetEvent TODO

func (*EventClient) RecordBatchEvents

func (e *EventClient) RecordBatchEvents(events []Event) (BatchEventResponse, error)

RecordBatchEvents send compressed events

func (*EventClient) RecordEvent

func (e *EventClient) RecordEvent(event Event) (int64, error)

RecordEvent send a single event

type EventGeo

type EventGeo struct {
	ID              int64
	Time            time.Time
	User            string
	Passwd          string
	RemoteAddr      string
	RemotePort      int
	RemoteName      string
	RemoteVersion   string
	RemoteCountry   string
	RemoteCity      string
	OriginAddr      string
	OriginCountry   string
	OriginCity      string
	RemoteLatitude  float64
	RemoteLongitude float64
	OriginLatitude  float64
	OriginLongitude float64
	MetroCode       uint
}

EventGeo event with location

type EventTime

type EventTime time.Time

EventTime Custom Serializer

func (EventTime) MarshalJSON

func (et EventTime) MarshalJSON() ([]byte, error)

func (*EventTime) Scan

func (et *EventTime) Scan(value interface{}) error

Scan Gets the value from epoch time

func (EventTime) String

func (et EventTime) String() string

func (*EventTime) UnmarshalJSON

func (et *EventTime) UnmarshalJSON(data []byte) (err error)

func (EventTime) Value

func (et EventTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type ReadTransporter

type ReadTransporter interface {
	GetEvent(id int64) (*EventGeo, error)
}

ReadTransporter for data

type RecordTransporter

type RecordTransporter interface {
	RecordEvent(event Event) (int64, error)
	RecordBatchEvents(events []Event) (BatchEventResponse, error)
}

RecordTransporter Methods to records password events

type Transporter

type Transporter interface {
	ReadTransporter
	RecordTransporter
}

Transporter for event Client

Jump to

Keyboard shortcuts

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