github.com/nyan233/littlerpc@v0.4.6-0.20230316182519-0c8d5c48abaf/core/server/config.go (about)

     1  package server
     2  
     3  import (
     4  	"github.com/lesismal/llib/std/crypto/tls"
     5  	"github.com/nyan233/littlerpc/core/common/logger"
     6  	"github.com/nyan233/littlerpc/core/common/metadata"
     7  	"github.com/nyan233/littlerpc/core/common/msgparser"
     8  	"github.com/nyan233/littlerpc/core/common/msgwriter"
     9  	"github.com/nyan233/littlerpc/core/middle/plugin"
    10  	perror "github.com/nyan233/littlerpc/core/protocol/error"
    11  	"github.com/nyan233/littlerpc/internal/pool"
    12  	"time"
    13  )
    14  
    15  type Config struct {
    16  	TlsConfig *tls.Config
    17  	// 使用的传输协议,默认实现tcp&websocket
    18  	NetWork   string
    19  	Address   []string
    20  	KeepAlive bool
    21  	// ping-pong timeout
    22  	KeepAliveTimeout time.Duration
    23  	Logger           logger.LLogger
    24  	// 使用的插件
    25  	Plugins         []plugin.ServerPlugin
    26  	ErrHandler      perror.LErrors
    27  	PoolMinSize     int32
    28  	PoolMaxSize     int32
    29  	PoolBufferSize  int32
    30  	ExecPoolBuilder pool.TaskPoolBuilder[string]
    31  	Debug           bool
    32  	ParserFactory   msgparser.Factory
    33  	WriterFactory   msgwriter.Factory
    34  	// Max 4GB, because low-level type is uint32
    35  	ReadBufferSize  int
    36  	WriteBufferSize int
    37  	// 是否开启反射服务
    38  	OpenReflection bool
    39  	// 默认的Service配置
    40  	DefaultProcessOption metadata.ProcessOption
    41  	//
    42  	RegisterMPOnRead bool
    43  }