types

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: Apache-2.0 Imports: 11 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
SocketMpushArgs
MpushTarget
SocketMpushReply
SocketKickArgs
SocketKickReply
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

func DefaultProxySelector

func DefaultProxySelector() func(*plugin.ProxyLabel) plugin.Caller

DefaultProxySelector creates a new default proxy caller selector.

Types

type AccessToken

type AccessToken interface {
	// String returns the access token string.
	String() string
	// SessionId specifies the string as the session ID.
	SessionId() string
	// Uid returns the user id.
	Uid() string
	// DeviceId returns the device id.
	DeviceId() string
	// AddedQuery the user information will be appended to the URI query part.
	AddedQuery() *utils.Args
}

AccessToken access token info

type AuthFunc

type AuthFunc func(authInfo string) (AccessToken, *tp.Rerror)

AuthFunc Verifies access token

func DefaultAuthFunc

func DefaultAuthFunc() AuthFunc

DefaultAuthFunc returns the default authorization function for access behavior.

type Business

type Business struct {
	// AuthFunc Verifies access token
	AuthFunc func(accessToken string) (AccessToken, *tp.Rerror)
	// SocketHooks TCP socket connecting event hooks
	SocketHooks
	// HttpHooks HTTP connecting event hooks
	HttpHooks
	// ProxySelector returns proxy caller by label.
	ProxySelector func(*plugin.ProxyLabel) plugin.Caller
	// InnerServerPlugins inner server plugins
	InnerServerPlugins []tp.Plugin
}

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

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

func (*GwHosts) GetSocket

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

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

HttpHooks HTTP connecting event hooks

func DefaultHttpHooks

func DefaultHttpHooks() HttpHooks

DefaultHttpHooks creates a new default HttpHooks object.

type MpushTarget

type MpushTarget struct {
	SessionId       string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	AdditionalQuery string `protobuf:"bytes,2,opt,name=additional_query,json=additionalQuery,proto3" json:"additional_query,omitempty"`
}

func (*MpushTarget) Descriptor

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

func (*MpushTarget) GetAdditionalQuery

func (m *MpushTarget) GetAdditionalQuery() string

func (*MpushTarget) GetSessionId

func (m *MpushTarget) GetSessionId() string

func (*MpushTarget) Marshal

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

func (*MpushTarget) MarshalTo

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

func (*MpushTarget) ProtoMessage

func (*MpushTarget) ProtoMessage()

func (*MpushTarget) Reset

func (m *MpushTarget) Reset()

func (*MpushTarget) Size

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

func (*MpushTarget) String

func (m *MpushTarget) String() string

func (*MpushTarget) Unmarshal

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

type RequestArgs

type RequestArgs interface {
	// Query returns query arguments from request URI.
	QueryArgs() *fasthttp.Args
	// Header returns the header object of request.
	Header() *fasthttp.RequestHeader
}

RequestArgs http query parameters

type SocketHooks

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

func DefaultSocketHooks() SocketHooks

DefaultSocketHooks creates a new default SocketHooks object.

type SocketKickArgs

type SocketKickArgs struct {
	SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
}

func (*SocketKickArgs) Descriptor

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

func (*SocketKickArgs) GetSessionId

func (m *SocketKickArgs) GetSessionId() string

func (*SocketKickArgs) Marshal

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

func (*SocketKickArgs) MarshalTo

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

func (*SocketKickArgs) ProtoMessage

func (*SocketKickArgs) ProtoMessage()

func (*SocketKickArgs) Reset

func (m *SocketKickArgs) Reset()

func (*SocketKickArgs) Size

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

func (*SocketKickArgs) String

func (m *SocketKickArgs) String() string

func (*SocketKickArgs) Unmarshal

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

type SocketKickReply

type SocketKickReply struct {
	Existed bool `protobuf:"varint,1,opt,name=existed,proto3" json:"existed,omitempty"`
}

func (*SocketKickReply) Descriptor

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

func (*SocketKickReply) GetExisted

func (m *SocketKickReply) GetExisted() bool

func (*SocketKickReply) Marshal

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

func (*SocketKickReply) MarshalTo

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

func (*SocketKickReply) ProtoMessage

func (*SocketKickReply) ProtoMessage()

func (*SocketKickReply) Reset

func (m *SocketKickReply) Reset()

func (*SocketKickReply) Size

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

func (*SocketKickReply) String

func (m *SocketKickReply) String() string

func (*SocketKickReply) Unmarshal

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

type SocketMpushArgs

type SocketMpushArgs struct {
	Target    []*MpushTarget `protobuf:"bytes,1,rep,name=target" json:"target,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 (*SocketMpushArgs) Descriptor

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

func (*SocketMpushArgs) GetBody

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

func (*SocketMpushArgs) GetBodyCodec

func (m *SocketMpushArgs) GetBodyCodec() int32

func (*SocketMpushArgs) GetTarget

func (m *SocketMpushArgs) GetTarget() []*MpushTarget

func (*SocketMpushArgs) GetUri

func (m *SocketMpushArgs) GetUri() string

func (*SocketMpushArgs) Marshal

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

func (*SocketMpushArgs) MarshalTo

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

func (*SocketMpushArgs) ProtoMessage

func (*SocketMpushArgs) ProtoMessage()

func (*SocketMpushArgs) Reset

func (m *SocketMpushArgs) Reset()

func (*SocketMpushArgs) Size

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

func (*SocketMpushArgs) String

func (m *SocketMpushArgs) String() string

func (*SocketMpushArgs) Unmarshal

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

type SocketMpushReply

type SocketMpushReply struct {
	FailureSessionIds []string `protobuf:"bytes,1,rep,name=failure_session_ids,json=failureSessionIds" json:"failure_session_ids,omitempty"`
}

func (*SocketMpushReply) Descriptor

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

func (*SocketMpushReply) GetFailureSessionIds

func (m *SocketMpushReply) GetFailureSessionIds() []string

func (*SocketMpushReply) Marshal

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

func (*SocketMpushReply) MarshalTo

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

func (*SocketMpushReply) ProtoMessage

func (*SocketMpushReply) ProtoMessage()

func (*SocketMpushReply) Reset

func (m *SocketMpushReply) Reset()

func (*SocketMpushReply) Size

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

func (*SocketMpushReply) String

func (m *SocketMpushReply) String() string

func (*SocketMpushReply) Unmarshal

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

type SocketPushArgs

type SocketPushArgs struct {
	SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,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

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

func (*SocketPushArgs) GetBody

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

func (*SocketPushArgs) GetBodyCodec

func (m *SocketPushArgs) GetBodyCodec() int32

func (*SocketPushArgs) GetSessionId

func (m *SocketPushArgs) GetSessionId() string

func (*SocketPushArgs) GetUri

func (m *SocketPushArgs) GetUri() string

func (*SocketPushArgs) Marshal

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

func (*SocketPushArgs) MarshalTo

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

func (*SocketPushArgs) ProtoMessage

func (*SocketPushArgs) ProtoMessage()

func (*SocketPushArgs) Reset

func (m *SocketPushArgs) Reset()

func (*SocketPushArgs) Size

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

func (*SocketPushArgs) String

func (m *SocketPushArgs) String() string

func (*SocketPushArgs) Unmarshal

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

type SocketPushReply

type SocketPushReply = codec.PbEmpty

SocketPushReply reply

type SocketTotalArgs

type SocketTotalArgs = codec.PbEmpty

SocketTotalArgs args

type SocketTotalReply

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

func (*SocketTotalReply) Descriptor

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

func (*SocketTotalReply) GetConnTotal

func (m *SocketTotalReply) GetConnTotal() int32

func (*SocketTotalReply) Marshal

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

func (*SocketTotalReply) MarshalTo

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

func (*SocketTotalReply) ProtoMessage

func (*SocketTotalReply) ProtoMessage()

func (*SocketTotalReply) Reset

func (m *SocketTotalReply) Reset()

func (*SocketTotalReply) Size

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

func (*SocketTotalReply) String

func (m *SocketTotalReply) String() string

func (*SocketTotalReply) Unmarshal

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