rpcxserver

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//StatusOn 启用
	StatusOn = "on"
	//StatusOff 关闭
	StatusOff = "off"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionFunc

type OptionFunc func(*Options)

func Addr

func Addr(a string) OptionFunc

func Network

func Network(n string) OptionFunc

func Port

func Port(p string) OptionFunc

func ReadTimeout

func ReadTimeout(t time.Duration) OptionFunc

func WithRegistryOptions

func WithRegistryOptions(registryOpts RegistryOptions) OptionFunc

func WriteTimeout

func WriteTimeout(t time.Duration) OptionFunc

type Options

type Options struct {
	Network      string        `ini:"network"`
	Addr         string        `ini:"addr"`
	Port         string        `ini:"port"`
	WriteTimeout time.Duration `ini:"writeTimeout"`
	ReadTimeout  time.Duration `ini:"readTimeout"`
	RegistryOpts RegistryOptions
}

Options server options

func DefaultOptions

func DefaultOptions() Options

DefaultOptions default config

type RegistryOptions

type RegistryOptions struct {
	Status         string        `ini:"status"`
	Addrs          []string      `ini:"addrs"`
	BasePath       string        `ini:"basePath"`
	UpdateInterval time.Duration `ini:"updateInterval"`
	UserName       string        `ini:"username"`
	Password       string        `ini:"password"`
	Group          string        `ini:"group"`
}

RegistryOptions 服务注册中心配置

type Server

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

Server struct

func NewServer

func NewServer(options ...OptionFunc) *Server

NewServer get server instance

func NewServerWithOptions

func NewServerWithOptions(opts Options) *Server

NewServerWithOptions with options

func (*Server) AddAfterServerStopFunc

func (srv *Server) AddAfterServerStopFunc(fns ...bootstrap.AfterServerStopFunc)

AddAfterServerStopFunc add after function

func (*Server) AddBeforeServerStartFunc

func (srv *Server) AddBeforeServerStartFunc(fns ...bootstrap.BeforeServerStartFunc)

AddBeforeServerStartFunc add before function

func (*Server) AddPlugins

func (srv *Server) AddPlugins(plugins ...server.Plugin)

AddPlugins 添加rpcx plugin

func (*Server) ConfigureOptions

func (srv *Server) ConfigureOptions(options ...OptionFunc)

ConfigureOptions 更新配置

func (*Server) DisableHTTPGateway

func (srv *Server) DisableHTTPGateway() bootstrap.BeforeServerStartFunc

DisableHTTPGateway 禁用本地网关模式

func (*Server) InitConfig

func (srv *Server) InitConfig() bootstrap.BeforeServerStartFunc

InitRegistry 初始化注册中心

func (*Server) InitRegistry

func (srv *Server) InitRegistry() bootstrap.BeforeServerStartFunc

InitRegistry 初始化注册中心

func (*Server) InitRpcxAuth

func (srv *Server) InitRpcxAuth(fns ...ValidAccess) bootstrap.BeforeServerStartFunc

InitRpcxAuth 初始化rpcx鉴权

func (*Server) InitRpcxPlugin

func (srv *Server) InitRpcxPlugin(plugins ...rpcxplugin.Options) bootstrap.BeforeServerStartFunc

InitRpcxPlugin 初始化rpcx插件

func (*Server) RegisterPlugin

func (srv *Server) RegisterPlugin() bootstrap.BeforeServerStartFunc

RegisterPlugin 添加rcpx plugin

func (*Server) RegisterServiceWithName

func (srv *Server) RegisterServiceWithName(name string, recv interface{}, metadata string) bootstrap.BeforeServerStartFunc

RegisterServiceWithName 用于注册自己的服务

func (*Server) RegisterServiceWithPlugin

func (srv *Server) RegisterServiceWithPlugin(name string, recv interface{}, metadata string) bootstrap.BeforeServerStartFunc

RegisterServiceWithName 用于注册带插件功能的服务

func (*Server) Serve

func (srv *Server) Serve() error

Start 初始化各种插件

func (*Server) Server

func (srv *Server) Server() *server.Server

Server 获取rpcx server

type ValidAccess

type ValidAccess func(string) (string, bool)

Jump to

Keyboard shortcuts

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