From 11eb541f2305a6266fac26f88164fa863332f216 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 14:08:59 +0300 Subject: [PATCH 1/2] state: add request to dump node config - regenerate proto files - regenerate proto docs --- docs/state.md | 36 ++++ state/service.pb.go | 511 +++++++++++++++++++++++++++++++++++++++++--- state/service.proto | 18 ++ 3 files changed, 538 insertions(+), 27 deletions(-) diff --git a/docs/state.md b/docs/state.md index e678be3..7950455 100644 --- a/docs/state.md +++ b/docs/state.md @@ -8,6 +8,8 @@ - [Status](#state.Status) - Messages + - [DumpRequest](#state.DumpRequest) + - [DumpResponse](#state.DumpResponse) - [HealthRequest](#state.HealthRequest) - [HealthResponse](#state.HealthResponse) - [MetricsRequest](#state.MetricsRequest) @@ -36,6 +38,7 @@ Status service provides node's healthcheck and status info rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); rpc Metrics(MetricsRequest) returns (MetricsResponse); rpc HealthCheck(HealthRequest) returns (HealthResponse); +rpc DumpConfig(DumpRequest) returns (DumpResponse); ``` @@ -61,9 +64,42 @@ If node unhealthy field Status would contains detailed info. | Name | Input | Output | | ---- | ----- | ------ | | HealthCheck | [HealthRequest](#state.HealthRequest) | [HealthResponse](#state.HealthResponse) | +#### Method DumpConfig + +DumpConfig request allows dumping settings for the current node. +To permit access, used server config options. +The request should be signed. + +| Name | Input | Output | +| ---- | ----- | ------ | +| DumpConfig | [DumpRequest](#state.DumpRequest) | [DumpResponse](#state.DumpResponse) | + + +### Message DumpRequest +DumpRequest message to fetch current server config. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + + + + +### Message DumpResponse +DumpResponse message contains current server config. +Config stored in JSON encoded into slice of bytes. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Config | [bytes](#bytes) | | | + + ### Message HealthRequest diff --git a/state/service.pb.go b/state/service.pb.go index 520c8ce..09cc645 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -249,44 +249,134 @@ func (m *HealthResponse) GetStatus() string { return "" } +// DumpRequest message to fetch current server config. +type DumpRequest struct { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DumpRequest) Reset() { *m = DumpRequest{} } +func (m *DumpRequest) String() string { return proto.CompactTextString(m) } +func (*DumpRequest) ProtoMessage() {} +func (*DumpRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{5} +} +func (m *DumpRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DumpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DumpRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DumpRequest.Merge(m, src) +} +func (m *DumpRequest) XXX_Size() int { + return m.Size() +} +func (m *DumpRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DumpRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DumpRequest proto.InternalMessageInfo + +// DumpResponse message contains current server config. +// Config stored in JSON encoded into slice of bytes. +type DumpResponse struct { + Config []byte `protobuf:"bytes,1,opt,name=Config,proto3" json:"Config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DumpResponse) Reset() { *m = DumpResponse{} } +func (m *DumpResponse) String() string { return proto.CompactTextString(m) } +func (*DumpResponse) ProtoMessage() {} +func (*DumpResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_695592f6f2fc97b7, []int{6} +} +func (m *DumpResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DumpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DumpResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DumpResponse.Merge(m, src) +} +func (m *DumpResponse) XXX_Size() int { + return m.Size() +} +func (m *DumpResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DumpResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DumpResponse proto.InternalMessageInfo + +func (m *DumpResponse) GetConfig() []byte { + if m != nil { + return m.Config + } + return nil +} + func init() { proto.RegisterType((*NetmapRequest)(nil), "state.NetmapRequest") proto.RegisterType((*MetricsRequest)(nil), "state.MetricsRequest") proto.RegisterType((*MetricsResponse)(nil), "state.MetricsResponse") proto.RegisterType((*HealthRequest)(nil), "state.HealthRequest") proto.RegisterType((*HealthResponse)(nil), "state.HealthResponse") + proto.RegisterType((*DumpRequest)(nil), "state.DumpRequest") + proto.RegisterType((*DumpResponse)(nil), "state.DumpResponse") } func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x93, 0xbf, 0xae, 0xd3, 0x30, - 0x14, 0xc6, 0xaf, 0xf9, 0x13, 0x2e, 0xbe, 0x70, 0x91, 0x4c, 0x5b, 0x45, 0x19, 0xd2, 0xa8, 0x03, - 0x8a, 0x84, 0x9a, 0x48, 0x85, 0xa1, 0x42, 0x4c, 0x85, 0xa1, 0x4b, 0x19, 0x52, 0x89, 0x81, 0xcd, - 0x71, 0x4f, 0xdb, 0x08, 0x1a, 0x9b, 0xf8, 0xa4, 0x52, 0x9f, 0x02, 0x46, 0x1e, 0x84, 0x87, 0xe8, - 0xd8, 0x91, 0xa9, 0x42, 0xe1, 0x45, 0x10, 0x8e, 0x13, 0x68, 0x79, 0x81, 0x6e, 0xf9, 0x7e, 0x5f, - 0x3e, 0xe7, 0xd3, 0xc9, 0x31, 0x7d, 0xaa, 0x91, 0x23, 0xc4, 0x1a, 0x8a, 0x6d, 0x26, 0x20, 0x52, - 0x85, 0x44, 0xc9, 0xee, 0x1b, 0xe8, 0x31, 0x4b, 0xe3, 0x0d, 0x20, 0xaf, 0x2d, 0xaf, 0xd3, 0xb0, - 0x2d, 0x14, 0xd9, 0x72, 0x67, 0x69, 0x37, 0x95, 0x12, 0x35, 0x16, 0x5c, 0xc5, 0xb8, 0x53, 0xa0, - 0x2d, 0x1e, 0xae, 0x32, 0x5c, 0x97, 0x69, 0x24, 0xe4, 0x26, 0x5e, 0xc9, 0x95, 0x8c, 0x0d, 0x4e, - 0xcb, 0xa5, 0x51, 0x46, 0x98, 0xa7, 0xfa, 0xf5, 0xc1, 0x17, 0x42, 0x1f, 0xbf, 0x03, 0xdc, 0x70, - 0x95, 0xc0, 0xe7, 0x12, 0x34, 0xb2, 0x31, 0xbd, 0x37, 0x03, 0xe4, 0x6e, 0x1a, 0x90, 0xf0, 0x66, - 0xe4, 0x45, 0x4d, 0x4d, 0xeb, 0xff, 0xf1, 0xa6, 0xc0, 0x17, 0x50, 0x4c, 0xae, 0xf7, 0xc7, 0xfe, - 0xd5, 0xe1, 0xd8, 0x27, 0x89, 0x49, 0xb0, 0xb7, 0xd4, 0x79, 0x6f, 0x1a, 0xba, 0xc2, 0x64, 0x07, - 0xe7, 0x59, 0xe3, 0x66, 0x82, 0x63, 0x26, 0xf3, 0xff, 0xce, 0xb0, 0xd9, 0xc1, 0x57, 0x42, 0x6f, - 0x67, 0x80, 0x45, 0x26, 0xf4, 0xa5, 0x54, 0x7a, 0x4e, 0x9f, 0xb4, 0x8d, 0xb4, 0x92, 0xb9, 0x06, - 0xe6, 0xd2, 0x07, 0x16, 0xb9, 0x24, 0xb8, 0x1b, 0x3e, 0x4a, 0x1a, 0x69, 0x26, 0x3a, 0x05, 0xfe, - 0x09, 0xd7, 0x97, 0x52, 0x7f, 0x42, 0x6f, 0x9b, 0x42, 0x7f, 0xdb, 0xd7, 0x64, 0xe7, 0x92, 0x80, - 0x84, 0xd7, 0x49, 0x23, 0x59, 0x8f, 0x3a, 0x73, 0xe4, 0x58, 0x6a, 0xf7, 0x4e, 0x40, 0xc2, 0x87, - 0x89, 0x55, 0xa3, 0xef, 0xa4, 0x31, 0xd8, 0x4b, 0xea, 0xd4, 0x1b, 0xc3, 0x3a, 0x91, 0x59, 0xda, - 0xe8, 0x64, 0x81, 0xbc, 0x4e, 0xd4, 0x6e, 0x66, 0x34, 0x57, 0x05, 0xf0, 0xc5, 0x8c, 0x2b, 0x36, - 0x6e, 0x07, 0xc6, 0xba, 0x36, 0x76, 0xfa, 0x97, 0xbd, 0xde, 0x39, 0xb6, 0x65, 0x5f, 0xd1, 0x9b, - 0xba, 0xdd, 0x9b, 0x35, 0x88, 0x8f, 0xed, 0x47, 0x4f, 0x66, 0xec, 0x75, 0xcf, 0x68, 0x9d, 0x9d, - 0xbc, 0xde, 0x57, 0x3e, 0x39, 0x54, 0x3e, 0xf9, 0x51, 0xf9, 0xe4, 0x67, 0xe5, 0x93, 0x6f, 0xbf, - 0xfc, 0xab, 0x0f, 0xcf, 0xfe, 0xb9, 0x23, 0xb9, 0x56, 0x42, 0x0c, 0x17, 0xb0, 0x8d, 0x73, 0x90, - 0x4b, 0x3d, 0xac, 0x6f, 0x88, 0x39, 0x2c, 0x75, 0x8c, 0x78, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0x78, 0x9b, 0x96, 0xe5, 0xb1, 0x03, 0x00, 0x00, + // 459 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xbf, 0x6e, 0xdb, 0x30, + 0x10, 0xc6, 0xc3, 0xfe, 0x51, 0xd3, 0xb3, 0x9b, 0x02, 0x8c, 0x6d, 0x08, 0x1a, 0x14, 0xc3, 0x43, + 0x60, 0xa0, 0xb0, 0x04, 0xa4, 0x2d, 0x10, 0x14, 0x9d, 0x9c, 0x0c, 0x59, 0xdc, 0x41, 0x01, 0x3a, + 0x74, 0xa3, 0xe4, 0xb3, 0x2d, 0xb4, 0x16, 0x59, 0xf1, 0x64, 0xc0, 0x0f, 0x51, 0xb4, 0x63, 0x1f, + 0x29, 0x63, 0xc6, 0x4e, 0x41, 0xe1, 0x8e, 0x7d, 0x89, 0x22, 0x24, 0xe5, 0xda, 0xce, 0x0b, 0x78, + 0xf3, 0xf7, 0x3b, 0x7d, 0xf4, 0x77, 0xe4, 0x91, 0x70, 0xac, 0x49, 0x10, 0xc6, 0x1a, 0xcb, 0x45, + 0x9e, 0x61, 0xa4, 0x4a, 0x49, 0x92, 0x3f, 0x35, 0x30, 0xe0, 0x8e, 0xc6, 0x73, 0x24, 0x61, 0x4b, + 0x41, 0xab, 0x66, 0x0b, 0x2c, 0xf3, 0xc9, 0xd2, 0xd1, 0x76, 0x2a, 0x25, 0x69, 0x2a, 0x85, 0x8a, + 0x69, 0xa9, 0x50, 0x3b, 0x3c, 0x98, 0xe6, 0x34, 0xab, 0xd2, 0x28, 0x93, 0xf3, 0x78, 0x2a, 0xa7, + 0x32, 0x36, 0x38, 0xad, 0x26, 0x46, 0x19, 0x61, 0x7e, 0xd9, 0xcf, 0x7b, 0xdf, 0x19, 0xbc, 0xf8, + 0x80, 0x34, 0x17, 0x2a, 0xc1, 0xaf, 0x15, 0x6a, 0xe2, 0xe7, 0xf0, 0x64, 0x84, 0x24, 0xfc, 0xb4, + 0xcb, 0xfa, 0x8d, 0xb3, 0x20, 0xaa, 0x63, 0xba, 0xfa, 0x7d, 0xed, 0x0a, 0xc5, 0x18, 0xcb, 0xe1, + 0xe1, 0xcd, 0xdd, 0xc9, 0xc1, 0xed, 0xdd, 0x09, 0x4b, 0x8c, 0x83, 0x5f, 0x82, 0xf7, 0xd1, 0x24, + 0xf4, 0x33, 0xe3, 0xed, 0xed, 0x7a, 0x4d, 0x35, 0xcf, 0x04, 0xe5, 0xb2, 0x78, 0xb0, 0x86, 0xf3, + 0xf6, 0x7e, 0x30, 0x38, 0x1a, 0x21, 0x95, 0x79, 0xa6, 0xf7, 0x25, 0xd2, 0x2b, 0x78, 0xb9, 0x4e, + 0xa4, 0x95, 0x2c, 0x34, 0x72, 0x1f, 0x9e, 0x39, 0xe4, 0xb3, 0xee, 0xe3, 0x7e, 0x33, 0xa9, 0xa5, + 0xd9, 0xd1, 0x2b, 0x14, 0x5f, 0x68, 0xb6, 0x2f, 0xf1, 0x87, 0x70, 0x54, 0x07, 0xfa, 0x9f, 0xde, + 0x92, 0xa5, 0xcf, 0xba, 0xac, 0x7f, 0x98, 0xd4, 0x92, 0x77, 0xc0, 0xbb, 0x26, 0x41, 0x95, 0xf6, + 0x1f, 0x75, 0x59, 0xff, 0x79, 0xe2, 0x54, 0xef, 0x1b, 0x83, 0xc6, 0x65, 0x35, 0xdf, 0x9b, 0x29, + 0x39, 0x85, 0xa6, 0x8d, 0xe3, 0x3a, 0xea, 0x80, 0x77, 0x21, 0x8b, 0x49, 0x3e, 0x35, 0x0d, 0x35, + 0x13, 0xa7, 0xce, 0xfe, 0xb2, 0xba, 0x21, 0xfe, 0x06, 0x3c, 0x3b, 0xe9, 0xbc, 0x15, 0x99, 0xcb, + 0x16, 0x6d, 0x0d, 0x7e, 0xd0, 0x8a, 0xd6, 0x37, 0x2a, 0xba, 0x56, 0x25, 0x8a, 0xf1, 0x48, 0x28, + 0x7e, 0xbe, 0x3e, 0x68, 0xde, 0x76, 0xb6, 0xed, 0xe9, 0x0c, 0x3a, 0xbb, 0xd8, 0x45, 0x7a, 0x07, + 0x0d, 0xbb, 0xab, 0x17, 0x33, 0xcc, 0x3e, 0xaf, 0xff, 0x74, 0x6b, 0x36, 0x82, 0xf6, 0x0e, 0x75, + 0xde, 0xb7, 0x00, 0xf7, 0xed, 0xd9, 0x26, 0x38, 0x77, 0x1f, 0x6d, 0x1c, 0x40, 0x70, 0xbc, 0xc5, + 0xac, 0x6d, 0xf8, 0xfe, 0x66, 0x15, 0xb2, 0xdb, 0x55, 0xc8, 0x7e, 0xad, 0x42, 0xf6, 0x7b, 0x15, + 0xb2, 0x9f, 0x7f, 0xc2, 0x83, 0x4f, 0xa7, 0x1b, 0x4f, 0x42, 0xa1, 0x55, 0x96, 0x0d, 0xc6, 0xb8, + 0x88, 0x0b, 0x94, 0x13, 0x3d, 0xb0, 0x0f, 0x82, 0x59, 0x2a, 0xf5, 0x8c, 0x78, 0xfd, 0x2f, 0x00, + 0x00, 0xff, 0xff, 0x88, 0xd9, 0x75, 0x33, 0xa0, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -308,6 +398,10 @@ type StatusClient interface { // HealthCheck request allows to check health status of the node. // If node unhealthy field Status would contains detailed info. HealthCheck(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) + // DumpConfig request allows dumping settings for the current node. + // To permit access, used server config options. + // The request should be signed. + DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) } type statusClient struct { @@ -345,6 +439,15 @@ func (c *statusClient) HealthCheck(ctx context.Context, in *HealthRequest, opts return out, nil } +func (c *statusClient) DumpConfig(ctx context.Context, in *DumpRequest, opts ...grpc.CallOption) (*DumpResponse, error) { + out := new(DumpResponse) + err := c.cc.Invoke(ctx, "/state.Status/DumpConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // StatusServer is the server API for Status service. type StatusServer interface { // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) @@ -354,6 +457,10 @@ type StatusServer interface { // HealthCheck request allows to check health status of the node. // If node unhealthy field Status would contains detailed info. HealthCheck(context.Context, *HealthRequest) (*HealthResponse, error) + // DumpConfig request allows dumping settings for the current node. + // To permit access, used server config options. + // The request should be signed. + DumpConfig(context.Context, *DumpRequest) (*DumpResponse, error) } // UnimplementedStatusServer can be embedded to have forward compatible implementations. @@ -369,6 +476,9 @@ func (*UnimplementedStatusServer) Metrics(ctx context.Context, req *MetricsReque func (*UnimplementedStatusServer) HealthCheck(ctx context.Context, req *HealthRequest) (*HealthResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") } +func (*UnimplementedStatusServer) DumpConfig(ctx context.Context, req *DumpRequest) (*DumpResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DumpConfig not implemented") +} func RegisterStatusServer(s *grpc.Server, srv StatusServer) { s.RegisterService(&_Status_serviceDesc, srv) @@ -428,6 +538,24 @@ func _Status_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Status_DumpConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DumpRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StatusServer).DumpConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/state.Status/DumpConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StatusServer).DumpConfig(ctx, req.(*DumpRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Status_serviceDesc = grpc.ServiceDesc{ ServiceName: "state.Status", HandlerType: (*StatusServer)(nil), @@ -444,6 +572,10 @@ var _Status_serviceDesc = grpc.ServiceDesc{ MethodName: "HealthCheck", Handler: _Status_HealthCheck_Handler, }, + { + MethodName: "DumpConfig", + Handler: _Status_DumpConfig_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "state/service.proto", @@ -682,6 +814,91 @@ func (m *HealthResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DumpRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DumpRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DumpRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + return len(dAtA) - i, nil +} + +func (m *DumpResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DumpResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DumpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintService(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintService(dAtA []byte, offset int, v uint64) int { offset -= sovService(v) base := offset @@ -778,6 +995,38 @@ func (m *HealthResponse) Size() (n int) { return n } +func (m *DumpRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DumpResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Config) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1336,6 +1585,214 @@ func (m *HealthResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *DumpRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DumpRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DumpRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DumpResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DumpResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DumpResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) + if m.Config == nil { + m.Config = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/state/service.proto b/state/service.proto index ed90e26..a30af22 100644 --- a/state/service.proto +++ b/state/service.proto @@ -18,6 +18,10 @@ service Status { // HealthCheck request allows to check health status of the node. // If node unhealthy field Status would contains detailed info. rpc HealthCheck(HealthRequest) returns (HealthResponse); + // DumpConfig request allows dumping settings for the current node. + // To permit access, used server config options. + // The request should be signed. + rpc DumpConfig(DumpRequest) returns (DumpResponse); } // NetmapRequest message to request current node netmap @@ -58,3 +62,17 @@ message HealthResponse { // Status contains detailed information about health status string Status = 2; } + +// DumpRequest message to fetch current server config. +message DumpRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} + +// DumpResponse message contains current server config. +// Config stored in JSON encoded into slice of bytes. +message DumpResponse { + bytes Config = 1; +} From 55b9a2447c3b84bb2766464b3f06e8be1e81331b Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 17 Dec 2019 14:09:52 +0300 Subject: [PATCH 2/2] state: add method to encode config into response message --- go.mod | 1 + go.sum | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ state/service.go | 14 +++++++ 3 files changed, 111 insertions(+) diff --git a/go.mod b/go.mod index dc07a30..fd114d3 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.2.1 github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 + github.com/spf13/viper v1.6.1 github.com/stretchr/testify v1.4.0 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 google.golang.org/grpc v1.24.0 diff --git a/go.sum b/go.sum index 13842ce..db7763e 100644 --- a/go.sum +++ b/go.sum @@ -1,61 +1,100 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310 h1:t+qxRrRtwNiUYA+Xh2jSXhoG2grnMCMKX4Fg6lx9X1U= github.com/awalterschulze/gographviz v0.0.0-20181013152038-b2885df04310/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -75,12 +114,16 @@ github.com/nspcc-dev/rfc6979 v0.1.0 h1:Lwg7esRRoyK1Up/IN1vAef1EmvrBeMHeeEkek2fAJ github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.3.0 h1:n6FTHsfPYbMi5Jmo6SwGVVRQD8i2w1P2ScCaW6rz69Q= github.com/nspcc-dev/tzhash v1.3.0/go.mod h1:Lc4DersKS8MNIrunTmsAzANO56qnG+LZ4GOE/WYGVzU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= @@ -88,39 +131,77 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= +github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -131,19 +212,34 @@ golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/nt golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/state/service.go b/state/service.go index dd2ec9b..cd7b685 100644 --- a/state/service.go +++ b/state/service.go @@ -1,9 +1,12 @@ package state import ( + "encoding/json" + "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/spf13/viper" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -46,3 +49,14 @@ func DecodeMetrics(r *MetricsResponse) ([]*MetricFamily, error) { return metrics, nil } + +// EncodeConfig encodes viper settings into DumpConfig message, +// if something went wrong returns gRPC Status error (can be returned from service). +func EncodeConfig(v *viper.Viper) (*DumpResponse, error) { + data, err := json.Marshal(v.AllSettings()) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &DumpResponse{Config: data}, nil +}