boots

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(opts ...Option)

Types

type ByteOrder

type ByteOrder int8

type Option

type Option func(*Options)

func WithByteOrderLittleEndian

func WithByteOrderLittleEndian() Option

使用小端字节序

func WithCustom

func WithCustom(key string, value any) Option

func WithHttpAddr

func WithHttpAddr(httpAddr string, opts ...*RouterOption) Option

WithHttpAddr sets the independent http address

func WithHttpHungup

func WithHttpHungup() Option

func WithInitializer

func WithInitializer(initializer channel.ChannelInitializer) Option

func WithKeyLengthInclude

func WithKeyLengthInclude() Option

包长度是否包含自己的长度

func WithLogger

func WithLogger(l logger.Logger) Option

func WithMsgType

func WithMsgType(msgType int) Option

func WithPacketBytesCount

func WithPacketBytesCount(packetBytesCount int32) Option

消息长度占用字节数

func WithReadLimit

func WithReadLimit(readLimit int32) Option

连接读取消息长度限制

func WithReadTimeOut

func WithReadTimeOut(readTimeOut int32) Option

连接读取消息超时时间

func WithSkipPacketBytesCount

func WithSkipPacketBytesCount() Option

跳过包长度

func WithTCPAddr

func WithTCPAddr(addr string) Option

WithTCPAddr sets the listen address which is used to establish connection between cluster members. Will select an available port automatically if no member address setting and panic if no available port

func WithTLSConfig

func WithTLSConfig(certificate, key string) Option

WithTLSConfig sets the `key` and `certificate` of TLS

func WithWriteTimeOut

func WithWriteTimeOut(writeTimeOut int32) Option

连接写入消息超时时间

type Options

type Options struct {
	TCPAddr        string
	HttpAddr       string
	TLSCertificate string // crt for tls
	TLSKey         string // key for tls

	Initializer   channel.ChannelInitializer
	Logger        logger.Logger
	RouterOptions []*RouterOption // 分组配置 (key:routerPath, value:options)
	MsgType       int             // WebSocket 消息类型
	HttpHungup    bool            // Http请求是否挂起
	//// param for conn
	ByteOrder            ByteOrder // 字节序
	ReadTimeOut          int32     // 连接读取消息超时时间
	WriteTimeOut         int32     // 连接写入消息超时时间
	ReadLimit            int32     // 连接读取消息长度限制
	PacketBytesCount     int32     // 消息长度占用字节数
	LengthInclude        bool      // 包长度是否包含自己的长度
	SkipPacketBytesCount bool      // 跳过包长度
	//// param for custom
	CustomDefine map[string]any
}

Options contains some configurations for current node

type Router

type Router func(path string) bool

type RouterOption

type RouterOption struct {
	Opts *Options
	// contains filtered or unexported fields
}

func WithRouterOption

func WithRouterOption(router Router, opts ...Option) *RouterOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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