basegate

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var RPC_PARAM_ProtocolMarshal_TYPE = gate.RPC_PARAM_ProtocolMarshal_TYPE
View Source
var RPC_PARAM_SESSION_TYPE = gate.RPC_PARAM_SESSION_TYPE

Functions

func NewGateHandler

func NewGateHandler(gate gate.Gate) *handler

func NewMqttAgent

func NewMqttAgent(module module.RPCModule) *agent

func NewSession

func NewSession(app module.App, data []byte) (gate.Session, error)

func NewSessionByMap

func NewSessionByMap(app module.App, data map[string]interface{}) (gate.Session, error)

Types

type Gate

type Gate struct {
	//module.RPCSerialize
	basemodule.BaseModule

	// websocket
	WSAddr      string
	HTTPTimeout time.Duration

	// tcp
	TCPAddr string

	//tls
	Tls      bool
	CertFile string
	KeyFile  string
	// contains filtered or unexported fields
}

func (*Gate) Deserialize

func (this *Gate) Deserialize(ptype string, b []byte) (param interface{}, err error)

func (*Gate) GetAgentLearner

func (this *Gate) GetAgentLearner() gate.AgentLearner

func (*Gate) GetGateHandler

func (this *Gate) GetGateHandler() gate.GateHandler

func (*Gate) GetJudgeGuest

func (this *Gate) GetJudgeGuest() func(session gate.Session) bool

func (*Gate) GetModule

func (this *Gate) GetModule() module.RPCModule

func (*Gate) GetRouteHandler

func (this *Gate) GetRouteHandler() gate.RouteHandler

func (*Gate) GetSessionLearner

func (this *Gate) GetSessionLearner() gate.SessionLearner

func (*Gate) GetStorageHandler

func (this *Gate) GetStorageHandler() (storage gate.StorageHandler)

func (*Gate) GetTypes

func (this *Gate) GetTypes() []string

func (*Gate) NewSession

func (this *Gate) NewSession(data []byte) (gate.Session, error)

func (*Gate) NewSessionByMap

func (this *Gate) NewSessionByMap(data map[string]interface{}) (gate.Session, error)

func (*Gate) OnAppConfigurationLoaded

func (this *Gate) OnAppConfigurationLoaded(app module.App)

func (*Gate) OnConfChanged

func (this *Gate) OnConfChanged(settings *conf.ModuleSettings)

func (*Gate) OnDestroy

func (this *Gate) OnDestroy()

func (*Gate) OnInit

func (this *Gate) OnInit(subclass module.RPCModule, app module.App, settings *conf.ModuleSettings, opts ...gate.Option)

func (*Gate) Options

func (this *Gate) Options() gate.Options

func (*Gate) Run

func (this *Gate) Run(closeSig chan bool)

func (*Gate) Serialize

func (this *Gate) Serialize(param interface{}) (ptype string, p []byte, err error)

* 自定义rpc参数序列化反序列化 Session

func (*Gate) SetCreateAgent

func (this *Gate) SetCreateAgent(cfunc func() gate.Agent) error

* 设置创建客户端Agent的函数

func (*Gate) SetJudgeGuest

func (this *Gate) SetJudgeGuest(judgeGuest func(session gate.Session) bool) error

func (*Gate) SetRouteHandler

func (this *Gate) SetRouteHandler(router gate.RouteHandler) error

* 设置Session信息持久化接口

func (*Gate) SetSessionLearner

func (this *Gate) SetSessionLearner(sessionLearner gate.SessionLearner) error

* 设置客户端连接和断开的监听器

func (*Gate) SetStorageHandler

func (this *Gate) SetStorageHandler(storage gate.StorageHandler) error

* 设置Session信息持久化接口

type SessionImp

type SessionImp struct {
	IP                   string            `protobuf:"bytes,1,opt,name=IP,proto3" json:"IP,omitempty"`
	Network              string            `protobuf:"bytes,2,opt,name=Network,proto3" json:"Network,omitempty"`
	UserId               string            `protobuf:"bytes,3,opt,name=UserId,proto3" json:"UserId,omitempty"`
	SessionId            string            `protobuf:"bytes,4,opt,name=SessionId,proto3" json:"SessionId,omitempty"`
	ServerId             string            `protobuf:"bytes,5,opt,name=ServerId,proto3" json:"ServerId,omitempty"`
	TraceId              string            `protobuf:"bytes,6,opt,name=TraceId,proto3" json:"TraceId,omitempty"`
	SpanId               string            `protobuf:"bytes,7,opt,name=SpanId,proto3" json:"SpanId,omitempty"`
	Settings             map[string]string `` /* 157-byte string literal not displayed */
	Carrier              map[string]string `` /* 155-byte string literal not displayed */
	Topic                string            `protobuf:"bytes,10,opt,name=Topic,proto3" json:"Topic,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*SessionImp) Descriptor

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

func (*SessionImp) GetCarrier

func (m *SessionImp) GetCarrier() map[string]string

func (*SessionImp) GetIP

func (m *SessionImp) GetIP() string

func (*SessionImp) GetNetwork

func (m *SessionImp) GetNetwork() string

func (*SessionImp) GetServerId

func (m *SessionImp) GetServerId() string

func (*SessionImp) GetSessionId

func (m *SessionImp) GetSessionId() string

func (*SessionImp) GetSettings

func (m *SessionImp) GetSettings() map[string]string

func (*SessionImp) GetSpanId

func (m *SessionImp) GetSpanId() string

func (*SessionImp) GetTopic

func (m *SessionImp) GetTopic() string

func (*SessionImp) GetTraceId

func (m *SessionImp) GetTraceId() string

func (*SessionImp) GetUserId

func (m *SessionImp) GetUserId() string

func (*SessionImp) ProtoMessage

func (*SessionImp) ProtoMessage()

func (*SessionImp) Reset

func (m *SessionImp) Reset()

func (*SessionImp) String

func (m *SessionImp) String() string

func (*SessionImp) XXX_DiscardUnknown

func (m *SessionImp) XXX_DiscardUnknown()

func (*SessionImp) XXX_Marshal

func (m *SessionImp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionImp) XXX_Merge

func (m *SessionImp) XXX_Merge(src proto.Message)

func (*SessionImp) XXX_Size

func (m *SessionImp) XXX_Size() int

func (*SessionImp) XXX_Unmarshal

func (m *SessionImp) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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