rpc

package
v0.0.0-...-d85f73f Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosedByRemote  = errors.New("connection is closed by remote")
	ErrClosedByTimeout = errors.New("connection is closed by timeout")
	ErrShutdown        = errors.New("connection is shut down")
)

Functions

func WithEngine

func WithEngine(ctx context.Context, e Engine) context.Context

Types

type Call

type Call struct {
	ServiceMethod         string
	ClientToServerMessage *codec.ClientToServerMessage
	ServerToClientMessage *codec.ServerToClientMessage
	Error                 error
	Done                  chan *Call
}

type Config

type Config struct {
	FixID       uint32
	AppID       uint32
	NetworkType uint8
	NetIPFamily uint8
	IMEI        string
	IMSI        string
	Revision    string
}

type Engine

type Engine interface {
	Start(ctx context.Context) error
	Ready(ch chan struct{})
	Close() error

	Call(
		serviceMethod string,
		c2s *codec.ClientToServerMessage,
		s2c *codec.ServerToClientMessage,
	) error
	CallWithDeadline(
		serviceMethod string,
		c2s *codec.ClientToServerMessage,
		s2c *codec.ServerToClientMessage,
		d time.Time,
	) error
	Go(
		serviceMethod string,
		c2s *codec.ClientToServerMessage,
		s2c *codec.ServerToClientMessage,
		done chan *Call,
	) *Call
	Register(serviceMethod string, f HandleFunc) error

	GetConfig() *Config
	GetNextSeq() uint32
	GetUserSignature(username string) *UserSignature

	SetConfig(cfg *Config)
	SetServers(list []string)
	SetUserSignature(username string, sig *UserSignature)
}

func ForEngine

func ForEngine(ctx context.Context) Engine

func NewEngine

func NewEngine(cfg *Config) Engine

type Session

type Session struct {
	Auth   []byte `json:"auth,omitempty"`
	Cookie []byte `json:"cookie"`
	KSID   []byte `json:"ksid,omitempty"`
}

type Ticket

type Ticket struct {
	Sig []byte `json:"sig"`
	Key []byte `json:"key,omitempty"`
	Iss int64  `json:"iss"`
	Exp int64  `json:"exp,omitempty"`
}

type UserSignature

type UserSignature struct {
	Username    string             `json:"username"`
	PasswordMD5 []byte             `json:"-"`
	DeviceToken []byte             `json:"deviceToken,omitempty"`
	Domains     map[string]string  `json:"domains,omitempty"`
	Tickets     map[string]*Ticket `json:"tickets,omitempty"`
	Session     *Session           `json:"session"`
}

Jump to

Keyboard shortcuts

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