Documentation ¶
Index ¶
- Constants
- Variables
- type AcceptMessage
- type CIDKEY
- type Client
- type ClientHandler
- type ClientID
- func (*ClientID) Descriptor() ([]byte, []int)deprecated
- func (cid *ClientID) Equal(other *ClientID) bool
- func (x *ClientID) GetAddress() string
- func (x *ClientID) GetId() string
- func (cid *ClientID) IsVaild() bool
- func (cid *ClientID) PostUserMessage(message []byte) error
- func (cid *ClientID) PostUserToMessage(message []byte, target net.Addr) error
- func (*ClientID) ProtoMessage()
- func (x *ClientID) ProtoReflect() protoreflect.Message
- func (x *ClientID) Reset()
- func (x *ClientID) String() string
- func (cid *ClientID) ToString() string
- func (cid *ClientID) UserClose() error
- type ClientIDSet
- func (cis *ClientIDSet) Clear()
- func (cis *ClientIDSet) Contains(v *ClientID) bool
- func (cis *ClientIDSet) Empty() bool
- func (cis *ClientIDSet) Erase(v *ClientID) bool
- func (cis *ClientIDSet) ForEach(f func(i int, cid *ClientID))
- func (cis *ClientIDSet) Get(index int) *ClientID
- func (cis *ClientIDSet) Len() int
- func (cis *ClientIDSet) Push(v *ClientID)
- func (cis *ClientIDSet) Values() []*ClientID
- type ClosedMessage
- type Config
- type ConfigOption
- type Context
- type HandleRegistryValue
- func (hr *HandleRegistryValue) Get(cid *ClientID) (Handler, bool)
- func (hr *HandleRegistryValue) GetLocal(id string) (Handler, bool)
- func (hr *HandleRegistryValue) NextId() string
- func (hr *HandleRegistryValue) Push(handler Handler, id string) (*ClientID, bool)
- func (hr *HandleRegistryValue) Remove(cid *ClientID)
- type Handler
- type MessageInvoker
- type NetworkModule
- type NetworkSystem
- func NewTCPServerNetworkSystem(options ...ConfigOption) *NetworkSystem
- func NewTCPServerNetworkSystemConfig(config *Config) *NetworkSystem
- func NewTCPSyncServerNetworkSystem(options ...ConfigOption) *NetworkSystem
- func NewTCPSyncServerNetworkSystemConfig(config *Config) *NetworkSystem
- func NewUDPNetworkSystem(options ...ConfigOption) *NetworkSystem
- func NewUDPNetworkSystemConfig(config *Config) *NetworkSystem
- type PingMessage
- type ProducerWidthClientSystem
- type RecviceMessage
Constants ¶
View Source
const (
LocalAddress = "nonhost"
)
Variables ¶
View Source
var File_client_id_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AcceptMessage ¶
type AcceptMessage struct { }
type ClientHandler ¶
type ClientHandler struct {
// contains filtered or unexported fields
}
func (*ClientHandler) Close ¶
func (c *ClientHandler) Close()
func (*ClientHandler) PostMessage ¶
func (c *ClientHandler) PostMessage(b []byte) error
func (*ClientHandler) PostToMessage ¶
func (c *ClientHandler) PostToMessage(b []byte, target net.Addr) error
type ClientID ¶
type ClientID struct { Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` // 地址 Id string `protobuf:"bytes,2,opt,name=Id,proto3" json:"Id,omitempty"` // 唯一标记 // contains filtered or unexported fields }
func NewClientID ¶
func (*ClientID) Descriptor
deprecated
func (*ClientID) GetAddress ¶
func (*ClientID) PostUserMessage ¶
func (*ClientID) PostUserToMessage ¶
func (*ClientID) ProtoMessage ¶
func (*ClientID) ProtoMessage()
func (*ClientID) ProtoReflect ¶
func (x *ClientID) ProtoReflect() protoreflect.Message
type ClientIDSet ¶
type ClientIDSet struct {
// contains filtered or unexported fields
}
func (*ClientIDSet) Clear ¶
func (cis *ClientIDSet) Clear()
Clear removes all the elements in the set.
func (*ClientIDSet) Contains ¶
func (cis *ClientIDSet) Contains(v *ClientID) bool
func (*ClientIDSet) Empty ¶
func (cis *ClientIDSet) Empty() bool
Empty reports whether the set is empty.
func (*ClientIDSet) Erase ¶
func (cis *ClientIDSet) Erase(v *ClientID) bool
func (*ClientIDSet) ForEach ¶
func (cis *ClientIDSet) ForEach(f func(i int, cid *ClientID))
ForEach invokes f for every element of the set.
func (*ClientIDSet) Get ¶
func (cis *ClientIDSet) Get(index int) *ClientID
func (*ClientIDSet) Len ¶
func (cis *ClientIDSet) Len() int
func (*ClientIDSet) Push ¶
func (cis *ClientIDSet) Push(v *ClientID)
func (*ClientIDSet) Values ¶
func (cis *ClientIDSet) Values() []*ClientID
Values returns all the elements of the set as a slice.
type ClosedMessage ¶
type ClosedMessage struct { }
type Config ¶
type Config struct { Producer ProducerWidthClientSystem Kleepalive int32 //网络超时(单位毫秒) VAddr string // 虚地址标记 }
func Configure ¶
func Configure(options ...ConfigOption) *Config
type ConfigOption ¶
type ConfigOption func(config *Config)
ConfigOption 是一个配置Network系统的函数
func WithProducer ¶
func WithProducer(producer ProducerWidthClientSystem) ConfigOption
func WithVAddr ¶
func WithVAddr(vaddr string) ConfigOption
type Context ¶
type Context interface { // Client Client() Client // Self clientId Self() *ClientID // NetworkSystem System object NetworkSystem() *NetworkSystem // Message 返回当前数据 Message() []byte MessageFrom() net.Addr PostMessage(*ClientID, []byte) error PostToMessage(*ClientID, []byte, net.Addr) error // Close 关闭当前连接 Close(*ClientID) }
type HandleRegistryValue ¶
type HandleRegistryValue struct { Address string // contains filtered or unexported fields }
func NewHandlerRegistry ¶
func NewHandlerRegistry(system *NetworkSystem, vaddr string) *HandleRegistryValue
func (*HandleRegistryValue) GetLocal ¶
func (hr *HandleRegistryValue) GetLocal(id string) (Handler, bool)
func (*HandleRegistryValue) NextId ¶
func (hr *HandleRegistryValue) NextId() string
func (*HandleRegistryValue) Push ¶
func (hr *HandleRegistryValue) Push(handler Handler, id string) (*ClientID, bool)
func (*HandleRegistryValue) Remove ¶
func (hr *HandleRegistryValue) Remove(cid *ClientID)
type MessageInvoker ¶
type MessageInvoker interface {
// contains filtered or unexported methods
}
type NetworkModule ¶
type NetworkSystem ¶
NetworkSystem 网络系统
func NewTCPServerNetworkSystem ¶
func NewTCPServerNetworkSystem(options ...ConfigOption) *NetworkSystem
func NewTCPServerNetworkSystemConfig ¶
func NewTCPServerNetworkSystemConfig(config *Config) *NetworkSystem
func NewTCPSyncServerNetworkSystem ¶
func NewTCPSyncServerNetworkSystem(options ...ConfigOption) *NetworkSystem
func NewTCPSyncServerNetworkSystemConfig ¶
func NewTCPSyncServerNetworkSystemConfig(config *Config) *NetworkSystem
func NewUDPNetworkSystem ¶
func NewUDPNetworkSystem(options ...ConfigOption) *NetworkSystem
func NewUDPNetworkSystemConfig ¶
func NewUDPNetworkSystemConfig(config *Config) *NetworkSystem
func (*NetworkSystem) Address ¶
func (ns *NetworkSystem) Address() string
func (*NetworkSystem) NewClientID ¶
func (ns *NetworkSystem) NewClientID(id string) *ClientID
func (*NetworkSystem) Open ¶
func (ns *NetworkSystem) Open(addr string) error
func (*NetworkSystem) Shutdown ¶
func (ns *NetworkSystem) Shutdown()
type PingMessage ¶
type PingMessage struct { }
type ProducerWidthClientSystem ¶
type ProducerWidthClientSystem func(*NetworkSystem) Client
type RecviceMessage ¶
Source Files ¶
- async_event.go
- client.go
- client_context.go
- client_handler.go
- client_id.go
- client_id.pb.go
- client_id_set.go
- config.go
- config_opts.go
- context.go
- handler.go
- handler_registry.go
- handler_service_sync_tcp.go
- handler_service_tcp.go
- handler_service_udp.go
- message_invoker.go
- module_service_sync_tcp.go
- module_service_tcp.go
- module_service_udp.go
- network_module.go
- network_system.go
- network_system_sync_tcp_service.go
- network_system_tcp_service.go
- network_system_udp_service.go
Click to show internal directories.
Click to hide internal directories.