server

package
v2.2.5 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	InsKind cluster.Kind // 集群类型
	InsID   string       // 集群ID
	// contains filtered or unexported fields
}

func (*Conn) Send

func (c *Conn) Send(buf buffer.Buffer) (err error)

Send 发送消息

type Options

type Options struct {
	Addr string // 监听地址
}

type RouteHandler

type RouteHandler func(conn *Conn, data []byte) error

type Server

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

func NewServer

func NewServer(opts *Options) (*Server, error)

func (*Server) Endpoint

func (s *Server) Endpoint() *endpoint.Endpoint

Endpoint 暴露端点

func (*Server) ExposeAddr

func (s *Server) ExposeAddr() string

ExposeAddr 暴露地址

func (*Server) ListenAddr

func (s *Server) ListenAddr() string

ListenAddr 监听地址

func (*Server) RegisterHandler

func (s *Server) RegisterHandler(route uint8, handler RouteHandler)

RegisterHandler 注册处理器

func (*Server) Scheme

func (s *Server) Scheme() string

Scheme 协议

func (*Server) Start

func (s *Server) Start() error

Start 启动服务器

func (*Server) Stop

func (s *Server) Stop() error

Stop 停止服务器

Jump to

Keyboard shortcuts

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