types

package
v6.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 12 Imported by: 7

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
WsTotalReply
WsPushArgs
WsMpushArgs
WsMpushReply
WsKickArgs
WsKickReply
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(*proxy.Label) proxy.Forwarder

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.Status)

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.Status)
	// SocketHooks TCP socket connecting event hooks
	SocketHooks
	// HttpHooks HTTP connecting event hooks
	HttpHooks
	// WebSocketHooks WEB socket connecting event hooks
	WebSocketHooks
	// ProxySelector returns proxy caller by label.
	ProxySelector func(*proxy.Label) proxy.Forwarder
	// 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"`
	Ws     []string `protobuf:"bytes,3,rep,name=ws" json:"ws,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) GetWs

func (m *GwHosts) GetWs() []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(params RequestArgs, body []byte, authFunc AuthFunc) (AccessToken, []tp.MessageSetting, *tp.Status)
}

HttpHooks HTTP connecting event hooks

func DefaultHttpHooks added in v1.1.0

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

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

SocketHooks TCP socket connecting event hooks

func DefaultSocketHooks added in v1.1.0

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

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 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) GetSessionId

func (m *SocketPushArgs) GetSessionId() 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

type WebSocketHooks

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

WebSocketHooks WEB socket connecting event hooks

func DefaultWebSocketHooks

func DefaultWebSocketHooks() WebSocketHooks

DefaultWebSocketHooks creates a new default WebSocketHooks object.

type WsKickArgs

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

func (*WsKickArgs) Descriptor

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

func (*WsKickArgs) GetSessionId

func (m *WsKickArgs) GetSessionId() string

func (*WsKickArgs) Marshal

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

func (*WsKickArgs) MarshalTo

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

func (*WsKickArgs) ProtoMessage

func (*WsKickArgs) ProtoMessage()

func (*WsKickArgs) Reset

func (m *WsKickArgs) Reset()

func (*WsKickArgs) Size

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

func (*WsKickArgs) String

func (m *WsKickArgs) String() string

func (*WsKickArgs) Unmarshal

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

type WsKickReply

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

func (*WsKickReply) Descriptor

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

func (*WsKickReply) GetExisted

func (m *WsKickReply) GetExisted() bool

func (*WsKickReply) Marshal

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

func (*WsKickReply) MarshalTo

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

func (*WsKickReply) ProtoMessage

func (*WsKickReply) ProtoMessage()

func (*WsKickReply) Reset

func (m *WsKickReply) Reset()

func (*WsKickReply) Size

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

func (*WsKickReply) String

func (m *WsKickReply) String() string

func (*WsKickReply) Unmarshal

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

type WsMpushArgs

type WsMpushArgs 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 (*WsMpushArgs) Descriptor

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

func (*WsMpushArgs) GetBody

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

func (*WsMpushArgs) GetBodyCodec

func (m *WsMpushArgs) GetBodyCodec() int32

func (*WsMpushArgs) GetTarget

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

func (*WsMpushArgs) GetUri

func (m *WsMpushArgs) GetUri() string

func (*WsMpushArgs) Marshal

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

func (*WsMpushArgs) MarshalTo

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

func (*WsMpushArgs) ProtoMessage

func (*WsMpushArgs) ProtoMessage()

func (*WsMpushArgs) Reset

func (m *WsMpushArgs) Reset()

func (*WsMpushArgs) Size

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

func (*WsMpushArgs) String

func (m *WsMpushArgs) String() string

func (*WsMpushArgs) Unmarshal

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

type WsMpushReply

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

func (*WsMpushReply) Descriptor

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

func (*WsMpushReply) GetFailureSessionIds

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

func (*WsMpushReply) Marshal

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

func (*WsMpushReply) MarshalTo

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

func (*WsMpushReply) ProtoMessage

func (*WsMpushReply) ProtoMessage()

func (*WsMpushReply) Reset

func (m *WsMpushReply) Reset()

func (*WsMpushReply) Size

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

func (*WsMpushReply) String

func (m *WsMpushReply) String() string

func (*WsMpushReply) Unmarshal

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

type WsPushArgs

type WsPushArgs 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 (*WsPushArgs) Descriptor

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

func (*WsPushArgs) GetBody

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

func (*WsPushArgs) GetBodyCodec

func (m *WsPushArgs) GetBodyCodec() int32

func (*WsPushArgs) GetSessionId

func (m *WsPushArgs) GetSessionId() string

func (*WsPushArgs) GetUri

func (m *WsPushArgs) GetUri() string

func (*WsPushArgs) Marshal

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

func (*WsPushArgs) MarshalTo

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

func (*WsPushArgs) ProtoMessage

func (*WsPushArgs) ProtoMessage()

func (*WsPushArgs) Reset

func (m *WsPushArgs) Reset()

func (*WsPushArgs) Size

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

func (*WsPushArgs) String

func (m *WsPushArgs) String() string

func (*WsPushArgs) Unmarshal

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

type WsPushReply

type WsPushReply = codec.PbEmpty

WsPushReply reply

type WsTotalArgs

type WsTotalArgs = codec.PbEmpty

WsTotalArgs args

type WsTotalReply

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

func (*WsTotalReply) Descriptor

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

func (*WsTotalReply) GetConnTotal

func (m *WsTotalReply) GetConnTotal() int32

func (*WsTotalReply) Marshal

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

func (*WsTotalReply) MarshalTo

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

func (*WsTotalReply) ProtoMessage

func (*WsTotalReply) ProtoMessage()

func (*WsTotalReply) Reset

func (m *WsTotalReply) Reset()

func (*WsTotalReply) Size

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

func (*WsTotalReply) String

func (m *WsTotalReply) String() string

func (*WsTotalReply) Unmarshal

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

Jump to

Keyboard shortcuts

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