types

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 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:

SocketTotalReply
SocketPushArgs
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 AccessTokenMgr added in v1.1.0

type AccessTokenMgr interface {
	// QueryForHttp queries access token from http query parameter
	QueryForHttp(args RequestArgs) string
	// Verify Verifies access token
	Verify(accessToken string) (AccessToken, *tp.Rerror)
}

AccessTokenMgr access token manager

func DefaultAccessTokenMgr added in v1.1.0

func DefaultAccessTokenMgr() AccessTokenMgr

DefaultAccessTokenMgr returns the default access token manager.

type Business

type Business struct {
	// AccessTokenMgr access token manager
	AccessTokenMgr
	// SocketHooks TCP socket connecting event hooks
	SocketHooks
	// HttpHooks HTTP connecting event hooks
	HttpHooks
	// 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 {
	Http   []string `protobuf:"bytes,1,rep,name=http" json:"http,omitempty"`
	Socket []string `protobuf:"bytes,2,rep,name=socket" json:"socket,omitempty"`
}

func (*GwHosts) Descriptor

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

func (*GwHosts) GetHttp added in v1.2.0

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

func (*GwHosts) GetSocket added in v1.2.0

func (m *GwHosts) GetSocket() []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 HttpHooks added in v1.1.0

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

HttpHooks HTTP connecting event hooks

func DefaultHttpHooks added in v1.1.0

func DefaultHttpHooks() HttpHooks

DefaultHttpHooks creates a new default HttpHooks 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 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
}

RequestArgs http query parameters

type SocketHooks added in v1.1.0

type SocketHooks interface {
	// OnLogon is called when the client goes online.
	OnLogon(plugin.AuthSession, AccessToken) *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
}

SocketHooks TCP socket connecting event hooks

func DefaultSocketHooks added in v1.1.0

func DefaultSocketHooks() SocketHooks

DefaultSocketHooks creates a new default SocketHooks object.

type SocketPushArgs added in v1.1.0

type SocketPushArgs 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 (*SocketPushArgs) Descriptor added in v1.1.0

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

func (*SocketPushArgs) GetBody added in v1.1.0

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

func (*SocketPushArgs) GetBodyCodec added in v1.1.0

func (m *SocketPushArgs) GetBodyCodec() int32

func (*SocketPushArgs) GetUid added in v1.1.0

func (m *SocketPushArgs) GetUid() string

func (*SocketPushArgs) GetUri added in v1.1.0

func (m *SocketPushArgs) GetUri() string

func (*SocketPushArgs) Marshal added in v1.1.0

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

func (*SocketPushArgs) MarshalTo added in v1.1.0

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

func (*SocketPushArgs) ProtoMessage added in v1.1.0

func (*SocketPushArgs) ProtoMessage()

func (*SocketPushArgs) Reset added in v1.1.0

func (m *SocketPushArgs) Reset()

func (*SocketPushArgs) Size added in v1.1.0

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

func (*SocketPushArgs) String added in v1.1.0

func (m *SocketPushArgs) String() string

func (*SocketPushArgs) Unmarshal added in v1.1.0

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

type SocketPushReply added in v1.1.0

type SocketPushReply = codec.PbEmpty

SocketPushReply reply

type SocketTotalArgs added in v1.1.0

type SocketTotalArgs = codec.PbEmpty

SocketTotalArgs args

type SocketTotalReply added in v1.1.0

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

func (*SocketTotalReply) Descriptor added in v1.1.0

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

func (*SocketTotalReply) GetConnTotal added in v1.1.0

func (m *SocketTotalReply) GetConnTotal() int32

func (*SocketTotalReply) Marshal added in v1.1.0

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

func (*SocketTotalReply) MarshalTo added in v1.1.0

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

func (*SocketTotalReply) ProtoMessage added in v1.1.0

func (*SocketTotalReply) ProtoMessage()

func (*SocketTotalReply) Reset added in v1.1.0

func (m *SocketTotalReply) Reset()

func (*SocketTotalReply) Size added in v1.1.0

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

func (*SocketTotalReply) String added in v1.1.0

func (m *SocketTotalReply) String() string

func (*SocketTotalReply) Unmarshal added in v1.1.0

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

Jump to

Keyboard shortcuts

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