v0.0.0-...-189d72e Latest Latest

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

Go to latest
Published: Nov 14, 2016 License: MIT Imports: 24 Imported by: 0




This section is empty.


View Source
var ErrAccountBanned = errors.New("Account is banned")

ErrAccountBanned happens when a request is sent with a banned account

View Source
var ErrBadRequest = errors.New("The remote service responded but appear to think the request is malformatted")

ErrBadRequest happens when the remote service thinks the request is malformatted

View Source
var ErrCheckChallenge = errors.New("ReCaptcha challenge was sent")

ErrCheckChallenge happens when the account gets flagged for a ReCaptcha challenge

View Source
var ErrFormatting = errors.New("Request was malformatted and could not be performed")

ErrFormatting happens when the something in the request body was not right

View Source
var ErrInvalidAuthToken = errors.New("The auth token used is not vailid")

ErrInvalidAuthToken happens when the currently used auth token is not vailid

View Source
var ErrInvalidPlatformRequest = errors.New("A platform specific request is invalid")

ErrInvalidPlatformRequest happens when a platform specific request like the request signature being incorrect

View Source
var ErrInvalidRequest = errors.New("The remote service responded but appear to think the request is invalid")

ErrInvalidRequest happens when the request is invalid

View Source
var ErrIpSoftBanned = errors.New("IP is softbanned")

ErrIpSoftBanned happens when a request is sent from a soft banned ip

View Source
var ErrNewRPCURL = errors.New("There is a new RPC url in the response, please use the new URL for future requests")

ErrNewRPCURL happens when there is a new RPC url available in the response body

View Source
var ErrNoURL = errors.New("The remote service did not respond with a remote URL when expected")

ErrNoURL happens when the remote service is expected to respond with a remote URL but doesn't

View Source
var ErrProxyDead = errors.New("Dead proxy")

ErrProxyDead happens when the provided proxy does not respond.

View Source
var ErrRedirect = errors.New("The request was redirected")

ErrRedirect happens when an invalid session endpoint has been used

View Source
var ErrRequest = errors.New("The remote service responded but the request could not be completed for unknown reasons")

ErrRequest happens when there is an unknown issue with the request

View Source
var ErrSessionInvalidated = errors.New("The session has been invalidated")

ErrSessionInvalidated happens when the session has been invalidated by the remote service

View Source
var LocalAddr net.Addr
View Source
var ProxyHost = ""


func GetErrorFromStatus

func GetErrorFromStatus(status protos.ResponseEnvelope_StatusCode) error

GetErrorFromStatus will, depending on the status code, give you an error or nil if there is no error


type CellIDs

type CellIDs []uint64

CellIDs is a slice of uint64s

func (CellIDs) Len

func (a CellIDs) Len() int

func (CellIDs) Less

func (a CellIDs) Less(i, j int) bool

func (CellIDs) Swap

func (a CellIDs) Swap(i, j int)

type ErrCheckChallengeURL

type ErrCheckChallengeURL error

type ErrResponse

type ErrResponse struct {
	// contains filtered or unexported fields

ErrResponse happens when there's something wrong with the response object

func (*ErrResponse) Error

func (e *ErrResponse) Error() string

type Feed

type Feed interface {
	// Push is used to put response messages on to the feed
	Push(entry interface{})

Feed is a common interface to act on encountered

type Location

type Location struct {
	Lon      float64
	Lat      float64
	Alt      float64
	Accuracy float64

Location consists of coordinates in longitude, latitude and altitude

func (*Location) DistanceToFort

func (l *Location) DistanceToFort(fort *protos.FortData) float64

DistanceToFort returns distance between the location and a fort using the Haversine formula Reference: https://gist.github.com/cdipaolo/d3f8db3848278b49db68

func (*Location) GetBytes

func (l *Location) GetBytes() []byte

GetBytes returns a byte slice of the location coordinates

func (*Location) GetCellIDs

func (l *Location) GetCellIDs() CellIDs

type ProxyResponse

type ProxyResponse struct {
	Status   int
	Response string

type RPC

type RPC struct {
	// contains filtered or unexported fields

RPC is used to communicate with the Pokémon Go API

func NewRPC

func NewRPC() *RPC

NewRPC constructs a Pokémon Go RPC API client

func (*RPC) Request

func (c *RPC) Request(ctx context.Context, endpoint string, requestEnvelope *protos.RequestEnvelope, proxyId int64) (responseEnvelope *protos.ResponseEnvelope, err error)

Request queries the Pokémon Go API will all pending requests

type Session

type Session struct {
	RPCID uint64
	// contains filtered or unexported fields

Session is used to communicate with the Pokémon Go API

func NewSession

func NewSession(signer *newcrypto.PogoSignature, provider auth.Provider, location *Location, feed Feed, debug bool) *Session

NewSession constructs a Pokémon Go RPC API client

func (*Session) Announce

func (s *Session) Announce(ctx context.Context, proxyId int64) (mapObjects *protos.GetMapObjectsResponse, err error)

Announce publishes the player's presence and returns the map environment

func (*Session) Call

func (s *Session) Call(ctx context.Context, requests []*protos.Request, proxyId int64) (*protos.ResponseEnvelope, error)

Call queries the Pokémon Go API through RPC protobuf

func (*Session) CheckChallenge

func (s *Session) CheckChallenge(ctx context.Context) (*protos.CheckChallengeResponse, error)

func (*Session) Encounter

func (s *Session) Encounter(ctx context.Context, encounterID uint64, spawnID string, loc *Location, proxyId int64) (*protos.EncounterResponse, error)

func (*Session) GetInventory

func (s *Session) GetInventory(ctx context.Context, proxyId int64) (*protos.GetInventoryResponse, error)

GetInventory returns the player items

func (*Session) GetPlayer

func (s *Session) GetPlayer(ctx context.Context, proxyId int64) (*protos.GetPlayerResponse, error)

func (*Session) GetPlayerMap

func (s *Session) GetPlayerMap(ctx context.Context, proxyId int64) (*protos.GetMapObjectsResponse, error)

GetPlayerMap returns the surrounding map cells

func (*Session) Init

func (s *Session) Init(ctx context.Context, proxyId int64) error

Init initializes the client by performing full authentication

func (*Session) IsExpired

func (s *Session) IsExpired() bool

IsExpired checks the expiration timestamp of the sessions AuthTicket if the session has a ticket and it is still valid, the return value is false if there is no ticket, or the ticket is expired, the return value is true

func (*Session) MoveTo

func (s *Session) MoveTo(location *Location)

MoveTo sets your current location

func (*Session) SetTimeout

func (s *Session) SetTimeout(d time.Duration)

SetTimeout sets the client timeout for the RPC API

func (*Session) SolveCaptcha

func (s *Session) SolveCaptcha(ctx context.Context, solution string) (*protos.VerifyChallengeResponse, error)

type VoidFeed

type VoidFeed struct {

VoidFeed is a feed that does nothing with the data

func (*VoidFeed) Push

func (f *VoidFeed) Push(entry interface{})

Push pushes the entry in to nothing

Jump to

Keyboard shortcuts

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