gtcp

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 6 Imported by: 0

README

TCP

server/gtcp 中基于 G 包 TCP 组件实现了 Server,用以注册 tcp 到 dove.Server() 中。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*gtcp.Server
	// contains filtered or unexported fields
}

Server 定义 TCP 服务包装器。

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer 新建 TCP 服务器。

func (*Server) Start

func (s *Server) Start(ctx context.Context) (err error)

Start 启动 TCP 服务器。

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop 停止 TCP 服务器。

type ServerOption

type ServerOption func(s *Server)

ServerOption 定义一个 TCP 服务选项类型。

func Address

func Address(address string) ServerOption

Address 配置服务监听地址。

func Handler

func Handler(handler func(conn *gtcp.Conn)) ServerOption

Handler 配置处理器。

func TLSConfig

func TLSConfig(c *tls.Config) ServerOption

TLSConfig 配置 TLS。

Jump to

Keyboard shortcuts

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