Documentation
¶
Index ¶
Constants ¶
View Source
const PluginName = "rpc"
PluginName contains default plugin name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Listen - address string (tcp://host:port or unix://file.sock).
Listen string `mapstructure:"listen"`
// RequestTimeout caps the read phases of an RPC request (header + body
// reads). Handler execution itself is bounded per-call by the request's
// context deadline. Streaming RPCs are not bounded by this value.
RequestTimeout time.Duration `mapstructure:"request_timeout"`
// TLS material; when set, both Cert and Key are required.
TLS *TLS `mapstructure:"tls"`
}
Config defines RPC service config.
func (*Config) InitDefaults ¶
func (c *Config) InitDefaults()
InitDefaults allows init blank config with a pre-defined set of default values.
type Configurer ¶
type Configurer interface {
// RRVersion returns current RR version
RRVersion() string
// Unmarshal returns the whole configuration
Unmarshal(out any) error
// UnmarshalKey takes a single key and unmarshal it into a Struct.
UnmarshalKey(name string, out any) error
// Has checks if config section exists.
Has(name string) bool
}
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is an RPC service.
func (*Plugin) Init ¶
func (s *Plugin) Init(cfg Configurer, log Logger) error
Init rpc service. Must return true if service is enabled.
type RPCer ¶
type RPCer interface {
// Name of the plugin.
Name() string
// RPC returns the URL prefix and HTTP handler this plugin wants mounted on
// the rpc server's mux.
RPC() (string, http.Handler)
}
RPCer declares the ability to expose a Connect-RPC service. Implementations typically delegate to a generated connect.NewXxxServiceHandler(impl).
Click to show internal directories.
Click to hide internal directories.