net

package
v0.0.0-...-643218b Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 19 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error)

func RecordPlayerOnlineStatus

func RecordPlayerOnlineStatus(online bool)

当玩家的在线状态在业务侧发生变化的时候调用方法

Types

type HashCodec

type HashCodec struct {
	// 返回 hash算法
	HashAlgoAndInData func(ctx netty.HandlerContext, message netty.Message) (uint, []byte)
	// 重新写入原生对象
	SetHashOutData func(ctx netty.HandlerContext, message netty.Message, data []byte) netty.Message
}

func (*HashCodec) CodecName

func (*HashCodec) CodecName() string

func (*HashCodec) HandleRead

func (c *HashCodec) HandleRead(ctx netty.InboundContext, message netty.Message)

func (*HashCodec) HandleWrite

func (c *HashCodec) HandleWrite(ctx netty.OutboundContext, message netty.Message)

type INetClient

type INetClient interface {
	Connect(url string, opts ...retry.Option) error

	Shutdown()

	Write(msg any)

	ChooseOne() netty.Channel
}

func DefaultNetClient

func DefaultNetClient(ops ...NetOption) INetClient

func NetClient

func NetClient(ops ...NetOption) INetClient

type NetOption

type NetOption func(options *netOptions)

func WithCodec

func WithCodec(codec codec.Codec) NetOption

func WithHandler

func WithHandler(handler ...netty.Handler) NetOption

func WithLbName

func WithLbName(lbName string) NetOption

func WithReadTimeOut

func WithReadTimeOut(readTimeOut time.Duration, readTimeOutFunc func(ctx netty.EventContext)) NetOption

func WithWriteTimeOut

func WithWriteTimeOut(writeTimeOut time.Duration, writeTimeOutFunc func(ctx netty.EventContext)) NetOption

type NetServer

type NetServer struct {
	// contains filtered or unexported fields
}

func NewNetServer

func NewNetServer(ops ...NetOption) *NetServer

func (*NetServer) Run

func (s *NetServer) Run(hostAndPort string) error

func (*NetServer) Shutdown

func (s *NetServer) Shutdown()

type PrometheusCodec

type PrometheusCodec struct{}

func (*PrometheusCodec) CodecName

func (*PrometheusCodec) CodecName() string

func (*PrometheusCodec) HandleActive

func (c *PrometheusCodec) HandleActive(ctx netty.ActiveContext)

func (*PrometheusCodec) HandleInactive

func (c *PrometheusCodec) HandleInactive(ctx netty.InactiveContext, ex netty.Exception)

func (*PrometheusCodec) HandleRead

func (c *PrometheusCodec) HandleRead(ctx netty.InboundContext, message netty.Message)

func (*PrometheusCodec) HandleWrite

func (c *PrometheusCodec) HandleWrite(ctx netty.OutboundContext, message netty.Message)

type ProtobufCodec

type ProtobufCodec struct {
	proto.Message
}

func (*ProtobufCodec) CodecName

func (*ProtobufCodec) CodecName() string

func (*ProtobufCodec) HandleRead

func (c *ProtobufCodec) HandleRead(ctx netty.InboundContext, message netty.Message)

func (*ProtobufCodec) HandleWrite

func (c *ProtobufCodec) HandleWrite(ctx netty.OutboundContext, message netty.Message)

type SymmetricCryptoCodec

type SymmetricCryptoCodec struct {
	// 返回 加密算法和secret ,iv
	CryptoAlgoAndSecret func(ctx netty.HandlerContext, message netty.Message) (string, []byte, []byte)
	// 返回要解密或者加密的数据
	CryptoData func(ctx netty.HandlerContext, message netty.Message) []byte
	// 重新写入原生对象
	SetCryptoData func(ctx netty.HandlerContext, message netty.Message, data []byte) netty.Message
}

func (*SymmetricCryptoCodec) CodecName

func (*SymmetricCryptoCodec) CodecName() string

func (*SymmetricCryptoCodec) HandleRead

func (c *SymmetricCryptoCodec) HandleRead(ctx netty.InboundContext, message netty.Message)

func (*SymmetricCryptoCodec) HandleWrite

func (c *SymmetricCryptoCodec) HandleWrite(ctx netty.OutboundContext, message netty.Message)

Jump to

Keyboard shortcuts

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