core

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RpcXServer

type RpcXServer struct {
	Address string // host:port
	Network string // tcp

	Plugins    []server.Plugin // 启动rpc服务时,自定义插件
	ServerName string          // rpc服务名
	Receiver   interface{}     // 路由结构 - 指针
	// contains filtered or unexported fields
}

func NewRpcXServer

func NewRpcXServer(config *RpcXServerConfig) (*RpcXServer, error)

func (*RpcXServer) Close

func (rpc *RpcXServer) Close()

func (*RpcXServer) Run

func (rpc *RpcXServer) Run()

type RpcXServerBaseConfig

type RpcXServerBaseConfig struct {
	Port       int    // rpc服务端口
	Address    string // rpc服务地址
	ServerName string // rpc服务名
	CertFile   string // tls证书
	KeyFile    string // tls证书
}

type RpcXServerConfig

type RpcXServerConfig struct {
	Base    *RpcXServerBaseConfig
	Options *RpcXServerOptionsConfig
	Etcd    *RpcXServerEtcdConfig
}

type RpcXServerEtcdConfig

type RpcXServerEtcdConfig struct {
	Nodes          []string
	BasePath       string
	UpdateInterval time.Duration
	Expired        time.Duration
}

type RpcXServerOptionsConfig

type RpcXServerOptionsConfig struct {
	ReadTimeout        time.Duration                // 读取超时时间
	WriteTimeout       time.Duration                // 写入超时时间
	Pool               *RpcXServerOptionsPoolConfig // 默认pond协程池 alitto/pond
	CustomPool         server.WorkerPool            // 自定义协程池 CustomPool和pool互斥
	AsyncWrite         bool                         // 是否异步写入
	TCPKeepAlivePeriod time.Duration                // tcp保持有效期
	// contains filtered or unexported fields
}

type RpcXServerOptionsPoolConfig

type RpcXServerOptionsPoolConfig struct {
	MaxWorkers  int // worker 工作goroutine的数量
	MaxCapacity int // capacity 最大的待处理的请求 超过capacity,新的请求就会被阻塞。
	PondOptions []pond.Option
}

type WebServer

type WebServer struct {
	Port    int
	Address string

	RouterFunc func(engine *gin.Engine)
	// contains filtered or unexported fields
}

func NewWebServer

func NewWebServer(opt *WebServerOptions) (*WebServer, error)

func (*WebServer) Close

func (web *WebServer) Close()

func (*WebServer) Get

func (web *WebServer) Get() *gin.Engine

func (*WebServer) Run

func (web *WebServer) Run()

func (*WebServer) ServeHTTP

func (web *WebServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

type WebServerOptions

type WebServerOptions struct {
	Mode       string
	Address    string
	Port       int
	RouterFunc func(engine *gin.Engine)
}

Jump to

Keyboard shortcuts

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