server

package
v0.0.0-...-5af7744 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	Protocol transport.Protocol // 通信协议
	Host     string             // 服务端地址

	SendChannelSize int
	// contains filtered or unexported fields
}

Option 每个服务端的配置

type OptionSetter

type OptionSetter func(option *Option)

OptionSetter 快速设置Option

func UseHTTP

func UseHTTP(host string) OptionSetter

func UseTCP

func UseTCP(host string) OptionSetter

func UseUnix

func UseUnix(host string) OptionSetter

type SendChannel

type SendChannel struct {
	Ch chan []byte
	// contains filtered or unexported fields
}

func NewSendChannel

func NewSendChannel(size int) *SendChannel

func (*SendChannel) Close

func (c *SendChannel) Close()

func (*SendChannel) Send

func (c *SendChannel) Send(data []byte) error

type Server

type Server struct {
	Option *Option // 管理器配置
	// contains filtered or unexported fields
}

Server 服务管理器

func NewServer

func NewServer() *Server

func (*Server) Register

func (s *Server) Register(v interface{}) error

func (Server) RegisterName

func (s Server) RegisterName(v interface{}, serviceName string) error

func (*Server) Run

func (s *Server) Run(fns ...OptionSetter) error

Jump to

Keyboard shortcuts

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