types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package types is a generated protocol buffer package.

It is generated from these files:

api.proto

It has these top-level messages:

TotalLongConnReply
PushLongConnArgs
GwHosts

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowApi   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type AccessToken

type AccessToken interface {
	// Uid returns the user id.
	Uid() string
	// String returns the access token string.
	String() string
}

AccessToken access token info

type AccessTokenVerifier

type AccessTokenVerifier func(accessToken string) (AccessToken, *tp.Rerror)

AccessTokenVerifier access token verifier

func DefaultAccessTokenVerifier

func DefaultAccessTokenVerifier() AccessTokenVerifier

DefaultAccessTokenVerifier returns the default access token verifier.

type Business

type Business struct {
	// ApiVersion long connection API version
	ApiVersion string
	// AccessTokenVerifier access token manager
	AccessTokenVerifier
	// LongConnHooks TCP socket connecting event hooks
	LongConnHooks
	// ShortConnHooks HTTP connecting event hooks
	ShortConnHooks
	// ProxyHooks proxy hooks
	ProxyHooks
}

Business implement your real business logic

func DefaultBusiness

func DefaultBusiness() *Business

DefaultBusiness creates a new default Business object.

func (*Business) Init

func (biz *Business) Init()

type GwHosts

type GwHosts struct {
	Hosts []string `protobuf:"bytes,1,rep,name=hosts" json:"hosts,omitempty"`
}

func (*GwHosts) Descriptor

func (*GwHosts) Descriptor() ([]byte, []int)

func (*GwHosts) GetHosts

func (m *GwHosts) GetHosts() []string

func (*GwHosts) Marshal

func (m *GwHosts) Marshal() (dAtA []byte, err error)

func (*GwHosts) MarshalTo

func (m *GwHosts) MarshalTo(dAtA []byte) (int, error)

func (*GwHosts) ProtoMessage

func (*GwHosts) ProtoMessage()

func (*GwHosts) Reset

func (m *GwHosts) Reset()

func (*GwHosts) Size

func (m *GwHosts) Size() (n int)

func (*GwHosts) String

func (m *GwHosts) String() string

func (*GwHosts) Unmarshal

func (m *GwHosts) Unmarshal(dAtA []byte) error

type LongConnHooks

type LongConnHooks interface {
	// OnLogon is called when the client goes online.
	OnLogon(AccessToken, plugin.AuthSession) *tp.Rerror
	// OnLogoff is called when the client goes offline.
	OnLogoff(tp.BaseSession) *tp.Rerror
	// GetSession returns session from peer by uid.
	GetSession(peer tp.Peer, uid string) (tp.Session, *tp.Rerror)
	//PreWritePush is executed before writing PUSH packet.
	PreWritePush(tp.WriteCtx) *tp.Rerror
}

LongConnHooks TCP socket connecting event hooks

func DefaultLongConnHooks

func DefaultLongConnHooks() LongConnHooks

DefaultLongConnHooks creates a new default LongConnHooks object.

type ProxyHooks

type ProxyHooks interface {
	// BeforePull is called before pulling the internal service.
	BeforePull(uri string, args interface{}, reply interface{}, setting ...socket.PacketSetting) *tp.Rerror
	// BeforePush is called before pushing the internal service.
	BeforePush(uri string, args interface{}, setting ...socket.PacketSetting) *tp.Rerror
}

ProxyHooks proxy hooks

func DefaultProxyHooks

func DefaultProxyHooks() ProxyHooks

DefaultProxyHooks creates a new default ProxyHooks object.

type PushLongConnArgs

type PushLongConnArgs struct {
	Uid       string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	Uri       string `protobuf:"bytes,2,opt,name=uri,proto3" json:"uri,omitempty"`
	Body      []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	BodyCodec int32  `protobuf:"varint,4,opt,name=body_codec,json=bodyCodec,proto3" json:"body_codec,omitempty"`
}

func (*PushLongConnArgs) Descriptor

func (*PushLongConnArgs) Descriptor() ([]byte, []int)

func (*PushLongConnArgs) GetBody

func (m *PushLongConnArgs) GetBody() []byte

func (*PushLongConnArgs) GetBodyCodec

func (m *PushLongConnArgs) GetBodyCodec() int32

func (*PushLongConnArgs) GetUid

func (m *PushLongConnArgs) GetUid() string

func (*PushLongConnArgs) GetUri

func (m *PushLongConnArgs) GetUri() string

func (*PushLongConnArgs) Marshal

func (m *PushLongConnArgs) Marshal() (dAtA []byte, err error)

func (*PushLongConnArgs) MarshalTo

func (m *PushLongConnArgs) MarshalTo(dAtA []byte) (int, error)

func (*PushLongConnArgs) ProtoMessage

func (*PushLongConnArgs) ProtoMessage()

func (*PushLongConnArgs) Reset

func (m *PushLongConnArgs) Reset()

func (*PushLongConnArgs) Size

func (m *PushLongConnArgs) Size() (n int)

func (*PushLongConnArgs) String

func (m *PushLongConnArgs) String() string

func (*PushLongConnArgs) Unmarshal

func (m *PushLongConnArgs) Unmarshal(dAtA []byte) error

type PushLongConnReply

type PushLongConnReply = codec.PbEmpty

PushLongConnReply reply

type RequestArgs

type RequestArgs interface {
	// Query returns query arguments from request URI.
	Query(key string) string
	// Header returns header value for the given key.
	Header(key string) string
	// Cookie returns cookie for the given key.
	Cookie(key string) string
}

type ShortConnHooks

type ShortConnHooks interface {
	// OnRequest is called when the client requests.
	OnRequest(AccessToken, RequestArgs) ([]socket.PacketSetting, *tp.Rerror)
}

ShortConnHooks HTTP connecting event hooks

func DefaultShortConnHooks

func DefaultShortConnHooks() ShortConnHooks

DefaultShortConnHooks creates a new default ShortConnHooks object.

type TotalLongConnArgs

type TotalLongConnArgs = codec.PbEmpty

TotalLongConnArgs args

type TotalLongConnReply

type TotalLongConnReply struct {
	ConnTotal int32 `protobuf:"varint,1,opt,name=conn_total,json=connTotal,proto3" json:"conn_total,omitempty"`
}

func (*TotalLongConnReply) Descriptor

func (*TotalLongConnReply) Descriptor() ([]byte, []int)

func (*TotalLongConnReply) GetConnTotal

func (m *TotalLongConnReply) GetConnTotal() int32

func (*TotalLongConnReply) Marshal

func (m *TotalLongConnReply) Marshal() (dAtA []byte, err error)

func (*TotalLongConnReply) MarshalTo

func (m *TotalLongConnReply) MarshalTo(dAtA []byte) (int, error)

func (*TotalLongConnReply) ProtoMessage

func (*TotalLongConnReply) ProtoMessage()

func (*TotalLongConnReply) Reset

func (m *TotalLongConnReply) Reset()

func (*TotalLongConnReply) Size

func (m *TotalLongConnReply) Size() (n int)

func (*TotalLongConnReply) String

func (m *TotalLongConnReply) String() string

func (*TotalLongConnReply) Unmarshal

func (m *TotalLongConnReply) Unmarshal(dAtA []byte) error

Jump to

Keyboard shortcuts

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