Documentation
¶
Overview ¶
Package config provides configuration for GRPC and HTTP api servers
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.0.0
type Config struct {
PublicServices []Service
PublicListener string `mapstructure:"grpc-public-listener"`
PrivateServices []Service
PrivateListener string `mapstructure:"grpc-private-listener"`
PostServices []Service
PostListener string `mapstructure:"grpc-post-listener"`
TLSServices []Service `mapstructure:"grpc-tls-services"`
TLSListener string `mapstructure:"grpc-tls-listener"`
TLSCACert string `mapstructure:"grpc-tls-ca-cert"`
TLSCert string `mapstructure:"grpc-tls-cert"`
TLSKey string `mapstructure:"grpc-tls-key"`
GrpcSendMsgSize int `mapstructure:"grpc-send-msg-size"`
GrpcRecvMsgSize int `mapstructure:"grpc-recv-msg-size"`
JSONListener string `mapstructure:"grpc-json-listener"`
JSONCorsAllowedOrigins []string `mapstructure:"grpc-cors-allowed-origins"`
SmesherStreamInterval time.Duration `mapstructure:"smesherstreaminterval"`
DatabaseConnections int `mapstructure:"db-connections"`
}
func DefaultConfig ¶ added in v1.0.0
func DefaultConfig() Config
DefaultConfig defines the default configuration options for api.
func DefaultTestConfig ¶ added in v1.0.0
DefaultTestConfig returns the default config for tests.
type JSONHTTPServer ¶
type JSONHTTPServer struct {
// BoundAddress contains the address that the server bound to, useful if
// the server uses a dynamic port. It is set during startup and can be
// safely accessed after Start has completed (I.E. the returned channel has
// been waited on)
BoundAddress string
// contains filtered or unexported fields
}
JSONHTTPServer is a JSON http server providing the Spacemesh API. It is implemented using a grpc-gateway. See https://github.com/grpc-ecosystem/grpc-gateway .
func NewJSONHTTPServer ¶
func NewJSONHTTPServer( lg *zap.Logger, listener string, corsAllowedOrigins []string, collectMetrics bool, ) *JSONHTTPServer
NewJSONHTTPServer creates a new json http server.
func (*JSONHTTPServer) Shutdown ¶ added in v1.0.0
func (s *JSONHTTPServer) Shutdown(ctx context.Context) error
Shutdown stops the server.
func (*JSONHTTPServer) StartService ¶
func (s *JSONHTTPServer) StartService( services ...ServiceAPI, ) error
StartService starts the json api server and listens for status (started, stopped).
type Server ¶
type Server struct {
// BoundAddress contains the address that the server bound to, useful if
// the server uses a dynamic port. It is set during startup and can be
// safely accessed after Start has completed (I.E. the returned channel has
// been waited on)
BoundAddress string
GrpcServer *grpc.Server
// contains filtered or unexported fields
}
Server is a very basic grpc server.
func New ¶ added in v1.0.0
New creates and returns a new Server listening on the given address. The server is configured with the given logger and config. Additional grpc options can be passed.
func NewTLS ¶ added in v1.3.0
NewTLS creates a new Server listening on the TLSListener address with the given logger and config. Services passed in the svc slice are registered with the server.
func NewWithServices ¶ added in v1.4.0
func NewWithServices( listener string, logger *zap.Logger, config Config, svc []ServiceAPI, grpcOpts ...grpc.ServerOption, ) (*Server, error)
NewWithServices creates a new Server listening on the provided address with the given logger and config. Services passed in the svc slice are registered with the server.
type Service ¶ added in v1.0.0
type Service = string
const ( // v1. Admin Service = "admin" Debug Service = "debug" GlobalState Service = "global" Mesh Service = "mesh" Transaction Service = "transaction" Activation Service = "activation" Smesher Service = "smesher" Post Service = "post" PostInfo Service = "postInfo" Node Service = "node" // v2alpha1. ActivationV2Alpha1 Service = "activation_v2alpha1" ActivationStreamV2Alpha1 Service = "activation_stream_v2alpha1" RewardV2Alpha1 Service = "reward_v2alpha1" RewardStreamV2Alpha1 Service = "reward_stream_v2alpha1" NetworkV2Alpha1 Service = "network_v2alpha1" NodeV2Alpha1 Service = "node_v2alpha1" LayerV2Alpha1 Service = "layer_v2alpha1" LayerStreamV2Alpha1 Service = "layer_stream_v2alpha1" TransactionV2Alpha1 Service = "transaction_v2alpha1" TransactionStreamV2Alpha1 Service = "transaction_stream_v2alpha1" AccountV2Alpha1 Service = "account_v2alpha1" MalfeasanceV2Alpha1 Service = "malfeasance_v2alpha1" MalfeasanceStreamV2Alpha1 Service = "malfeasance_stream_v2alpha1" // v2beta1. ActivationV2Beta1 Service = "activation_v2beta1" ActivationStreamV2Beta1 Service = "activation_stream_v2beta1" RewardV2Beta1 Service = "reward_v2beta1" RewardStreamV2Beta1 Service = "reward_stream_v2beta1" NetworkV2Beta1 Service = "network_v2beta1" NodeV2Beta1 Service = "node_v2beta1" LayerV2Beta1 Service = "layer_v2beta1" LayerStreamV2Beta1 Service = "layer_stream_v2beta1" TransactionV2Beta1 Service = "transaction_v2beta1" TransactionStreamV2Beta1 Service = "transaction_stream_v2beta1" AccountV2Beta1 Service = "account_v2beta1" MalfeasanceV2Beta1 Service = "malfeasance_v2beta1" MalfeasanceStreamV2Beta1 Service = "malfeasance_stream_v2beta1" )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package v1 is a generated GoMock package.
|
Package v1 is a generated GoMock package. |
|
Package v2alpha1 is a generated GoMock package.
|
Package v2alpha1 is a generated GoMock package. |
|
Package v2alpha1 is a generated GoMock package.
|
Package v2alpha1 is a generated GoMock package. |