buddyauth

package
Version: v0.0.0-...-83b534f Latest Latest
Warning

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

Go to latest
Published: May 8, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToRequest = errors.New("Failed to request hash server")
	ErrKeyPassedLimit  = errors.New("Key passed the limit")
	ErrBadRequest      = errors.New("Something wrong in the request")
	ErrInvalidKey      = errors.New("Invalid or expired key")
	ErrNoAvailableKey  = errors.New("No hash key is available")
)
View Source
var (
	Debug bool
)

Functions

This section is empty.

Types

type BuddyKey

type BuddyKey struct {
	Key       string
	RPM       int
	Used      int
	NextReset time.Time
	Invalid   bool
	Expired   bool
	sync.RWMutex
}

func (*BuddyKey) AddUsed

func (b *BuddyKey) AddUsed(n int)

func (*BuddyKey) GetNextReset

func (b *BuddyKey) GetNextReset() time.Time

func (*BuddyKey) GetRPM

func (b *BuddyKey) GetRPM() int

func (*BuddyKey) GetUsed

func (b *BuddyKey) GetUsed() int

func (*BuddyKey) IsExpired

func (b *BuddyKey) IsExpired() bool

func (*BuddyKey) IsInvalid

func (b *BuddyKey) IsInvalid() bool

func (*BuddyKey) ResetUsed

func (b *BuddyKey) ResetUsed()

func (*BuddyKey) SetExpired

func (b *BuddyKey) SetExpired(v bool)

func (*BuddyKey) SetInvalid

func (b *BuddyKey) SetInvalid(v bool)

func (*BuddyKey) SetNextReset

func (b *BuddyKey) SetNextReset(t time.Time)

func (*BuddyKey) SetRPM

func (b *BuddyKey) SetRPM(n int)

type HashRequest

type HashRequest struct {
	Timestamp   uint64   `json:"timestamp"`
	Latitude    int64    `json:"Latitude64"`
	Longitude   int64    `json:"Longitude64"`
	Accuracy    int64    `json:"Accuracy64"`
	AuthTicket  string   `json:"authTicket"`
	SessionData string   `json:"sessionData"`
	Requests    []string `json:"requests"`
}

type HashResponse

type HashResponse struct {
	LocationAuthHash uint32  `json:"locationAuthHash"`
	LocationHash     uint32  `json:"locationHash"`
	RequestHashes    []int64 `json:"RequestHashes"`
}

type Provider

type Provider struct {
	http.Client
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(apiVersion int) (*Provider, error)

func (*Provider) AddKey

func (p *Provider) AddKey(key string) error

func (*Provider) ApiURL

func (p *Provider) ApiURL() string

func (*Provider) DelKey

func (p *Provider) DelKey(key string) error

func (*Provider) GetAvailableKey

func (p *Provider) GetAvailableKey() (*BuddyKey, error)

func (*Provider) GetKeys

func (p *Provider) GetKeys() []interface{}

func (*Provider) Hash

func (p *Provider) Hash(authTicket, sessionData []byte, latitude, longitude, accuracy float64, timestamp uint64, requests [][]byte) (uint32, uint32, []uint64, error)

func (*Provider) SetDebug

func (p *Provider) SetDebug(d bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL