initialize
This commit is contained in:
snoop 2017-06-06 16:36:07 +09:00
parent 2f65275b13
commit 94672567e0
2 changed files with 249 additions and 21 deletions

View File

@ -10,6 +10,10 @@ It is generated from these files:
It has these top-level messages: It has these top-level messages:
AgentInfo AgentInfo
InitResponse InitResponse
ReqTempKeyInfo
TempKeyInfo
TempKey
AuthStatus
*/ */
package initialize package initialize
@ -33,6 +37,30 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AuthStatus_AuthStatusType int32
const (
AuthStatus_AUTH_WAIT AuthStatus_AuthStatusType = 0
AuthStatus_AUTH_ACCEPT AuthStatus_AuthStatusType = 1
AuthStatus_AUTH_REFUSE AuthStatus_AuthStatusType = 2
)
var AuthStatus_AuthStatusType_name = map[int32]string{
0: "AUTH_WAIT",
1: "AUTH_ACCEPT",
2: "AUTH_REFUSE",
}
var AuthStatus_AuthStatusType_value = map[string]int32{
"AUTH_WAIT": 0,
"AUTH_ACCEPT": 1,
"AUTH_REFUSE": 2,
}
func (x AuthStatus_AuthStatusType) String() string {
return proto.EnumName(AuthStatus_AuthStatusType_name, int32(x))
}
func (AuthStatus_AuthStatusType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 0} }
type AgentInfo struct { type AgentInfo struct {
AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"` AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"`
} }
@ -65,9 +93,102 @@ func (m *InitResponse) GetSecretKey() string {
return "" return ""
} }
type ReqTempKeyInfo struct {
ApiKey string `protobuf:"bytes,1,opt,name=apiKey" json:"apiKey,omitempty"`
LocalIp int64 `protobuf:"varint,2,opt,name=localIp" json:"localIp,omitempty"`
HostName string `protobuf:"bytes,3,opt,name=hostName" json:"hostName,omitempty"`
}
func (m *ReqTempKeyInfo) Reset() { *m = ReqTempKeyInfo{} }
func (m *ReqTempKeyInfo) String() string { return proto.CompactTextString(m) }
func (*ReqTempKeyInfo) ProtoMessage() {}
func (*ReqTempKeyInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *ReqTempKeyInfo) GetApiKey() string {
if m != nil {
return m.ApiKey
}
return ""
}
func (m *ReqTempKeyInfo) GetLocalIp() int64 {
if m != nil {
return m.LocalIp
}
return 0
}
func (m *ReqTempKeyInfo) GetHostName() string {
if m != nil {
return m.HostName
}
return ""
}
type TempKeyInfo struct {
TempKey string `protobuf:"bytes,1,opt,name=tempKey" json:"tempKey,omitempty"`
PollInterval float64 `protobuf:"fixed64,2,opt,name=pollInterval" json:"pollInterval,omitempty"`
}
func (m *TempKeyInfo) Reset() { *m = TempKeyInfo{} }
func (m *TempKeyInfo) String() string { return proto.CompactTextString(m) }
func (*TempKeyInfo) ProtoMessage() {}
func (*TempKeyInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *TempKeyInfo) GetTempKey() string {
if m != nil {
return m.TempKey
}
return ""
}
func (m *TempKeyInfo) GetPollInterval() float64 {
if m != nil {
return m.PollInterval
}
return 0
}
type TempKey struct {
Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
}
func (m *TempKey) Reset() { *m = TempKey{} }
func (m *TempKey) String() string { return proto.CompactTextString(m) }
func (*TempKey) ProtoMessage() {}
func (*TempKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *TempKey) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
type AuthStatus struct {
Type AuthStatus_AuthStatusType `protobuf:"varint,1,opt,name=type,enum=AuthStatus_AuthStatusType" json:"type,omitempty"`
}
func (m *AuthStatus) Reset() { *m = AuthStatus{} }
func (m *AuthStatus) String() string { return proto.CompactTextString(m) }
func (*AuthStatus) ProtoMessage() {}
func (*AuthStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *AuthStatus) GetType() AuthStatus_AuthStatusType {
if m != nil {
return m.Type
}
return AuthStatus_AUTH_WAIT
}
func init() { func init() {
proto.RegisterType((*AgentInfo)(nil), "AgentInfo") proto.RegisterType((*AgentInfo)(nil), "AgentInfo")
proto.RegisterType((*InitResponse)(nil), "InitResponse") proto.RegisterType((*InitResponse)(nil), "InitResponse")
proto.RegisterType((*ReqTempKeyInfo)(nil), "ReqTempKeyInfo")
proto.RegisterType((*TempKeyInfo)(nil), "TempKeyInfo")
proto.RegisterType((*TempKey)(nil), "TempKey")
proto.RegisterType((*AuthStatus)(nil), "AuthStatus")
proto.RegisterEnum("AuthStatus_AuthStatusType", AuthStatus_AuthStatusType_name, AuthStatus_AuthStatusType_value)
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -81,7 +202,9 @@ const _ = grpc.SupportPackageIsVersion4
// Client API for Initializer service // Client API for Initializer service
type InitializerClient interface { type InitializerClient interface {
AgentStarting(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*InitResponse, error) StartAgent(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*InitResponse, error)
RequestTempKey(ctx context.Context, in *ReqTempKeyInfo, opts ...grpc.CallOption) (*TempKeyInfo, error)
CheckAuth(ctx context.Context, in *TempKey, opts ...grpc.CallOption) (*AuthStatus, error)
} }
type initializerClient struct { type initializerClient struct {
@ -92,9 +215,27 @@ func NewInitializerClient(cc *grpc.ClientConn) InitializerClient {
return &initializerClient{cc} return &initializerClient{cc}
} }
func (c *initializerClient) AgentStarting(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*InitResponse, error) { func (c *initializerClient) StartAgent(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*InitResponse, error) {
out := new(InitResponse) out := new(InitResponse)
err := grpc.Invoke(ctx, "/Initializer/agentStarting", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/Initializer/startAgent", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *initializerClient) RequestTempKey(ctx context.Context, in *ReqTempKeyInfo, opts ...grpc.CallOption) (*TempKeyInfo, error) {
out := new(TempKeyInfo)
err := grpc.Invoke(ctx, "/Initializer/requestTempKey", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *initializerClient) CheckAuth(ctx context.Context, in *TempKey, opts ...grpc.CallOption) (*AuthStatus, error) {
out := new(AuthStatus)
err := grpc.Invoke(ctx, "/Initializer/CheckAuth", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -104,27 +245,65 @@ func (c *initializerClient) AgentStarting(ctx context.Context, in *AgentInfo, op
// Server API for Initializer service // Server API for Initializer service
type InitializerServer interface { type InitializerServer interface {
AgentStarting(context.Context, *AgentInfo) (*InitResponse, error) StartAgent(context.Context, *AgentInfo) (*InitResponse, error)
RequestTempKey(context.Context, *ReqTempKeyInfo) (*TempKeyInfo, error)
CheckAuth(context.Context, *TempKey) (*AuthStatus, error)
} }
func RegisterInitializerServer(s *grpc.Server, srv InitializerServer) { func RegisterInitializerServer(s *grpc.Server, srv InitializerServer) {
s.RegisterService(&_Initializer_serviceDesc, srv) s.RegisterService(&_Initializer_serviceDesc, srv)
} }
func _Initializer_AgentStarting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Initializer_StartAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AgentInfo) in := new(AgentInfo)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(InitializerServer).AgentStarting(ctx, in) return srv.(InitializerServer).StartAgent(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/Initializer/AgentStarting", FullMethod: "/Initializer/StartAgent",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(InitializerServer).AgentStarting(ctx, req.(*AgentInfo)) return srv.(InitializerServer).StartAgent(ctx, req.(*AgentInfo))
}
return interceptor(ctx, in, info, handler)
}
func _Initializer_RequestTempKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqTempKeyInfo)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(InitializerServer).RequestTempKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Initializer/RequestTempKey",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(InitializerServer).RequestTempKey(ctx, req.(*ReqTempKeyInfo))
}
return interceptor(ctx, in, info, handler)
}
func _Initializer_CheckAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TempKey)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(InitializerServer).CheckAuth(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Initializer/CheckAuth",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(InitializerServer).CheckAuth(ctx, req.(*TempKey))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -134,8 +313,16 @@ var _Initializer_serviceDesc = grpc.ServiceDesc{
HandlerType: (*InitializerServer)(nil), HandlerType: (*InitializerServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {
MethodName: "agentStarting", MethodName: "startAgent",
Handler: _Initializer_AgentStarting_Handler, Handler: _Initializer_StartAgent_Handler,
},
{
MethodName: "requestTempKey",
Handler: _Initializer_RequestTempKey_Handler,
},
{
MethodName: "CheckAuth",
Handler: _Initializer_CheckAuth_Handler,
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
@ -145,14 +332,28 @@ var _Initializer_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("initialize.proto", fileDescriptor0) } func init() { proto.RegisterFile("initialize.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 144 bytes of a gzipped FileDescriptorProto // 363 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0xcc, 0xcb, 0x2c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xe1, 0x6a, 0xa3, 0x40,
0xc9, 0x4c, 0xcc, 0xc9, 0xac, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x52, 0xe5, 0xe2, 0x14, 0x85, 0x35, 0xd9, 0x4d, 0xe2, 0x35, 0x31, 0x32, 0x2c, 0x8b, 0x48, 0xa1, 0x61, 0x68, 0x21,
0x74, 0x4c, 0x4f, 0xcd, 0x2b, 0xf1, 0xcc, 0x4b, 0xcb, 0x17, 0x92, 0xe0, 0x62, 0x4f, 0x04, 0x73, 0x85, 0x22, 0x34, 0x7d, 0x02, 0x09, 0x29, 0x95, 0x40, 0x29, 0xc6, 0xd0, 0x7f, 0x2d, 0xd3, 0xf4,
0x52, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x60, 0x5c, 0x25, 0x1d, 0x2e, 0x1e, 0xcf, 0xbc, 0xb6, 0x91, 0x1a, 0x9d, 0xe8, 0x18, 0xb0, 0x7f, 0xfa, 0x0c, 0x7d, 0xe3, 0x92, 0x89, 0x1a, 0xf3,
0xcc, 0x92, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x21, 0x19, 0x2e, 0xce, 0xe2, 0xd4, 0xcf, 0xef, 0xcc, 0xf1, 0xcc, 0xbd, 0x9c, 0x01, 0x33, 0x8c, 0x43, 0x11, 0xb2, 0x28, 0xfc, 0x42,
0xe4, 0xa2, 0xd4, 0x12, 0xef, 0xd4, 0x4a, 0xa8, 0x5a, 0x84, 0x80, 0x91, 0x35, 0x17, 0xb7, 0x27, 0x87, 0xa7, 0x89, 0x48, 0xe8, 0x25, 0x68, 0xee, 0x07, 0xc6, 0xc2, 0x8b, 0xdf, 0x13, 0x62, 0x41,
0xdc, 0xa2, 0x22, 0x21, 0x1d, 0x2e, 0x5e, 0xb0, 0x39, 0xc1, 0x25, 0x89, 0x45, 0x25, 0x99, 0x79, 0x97, 0x49, 0x78, 0xb3, 0xd4, 0x91, 0x3a, 0xd6, 0xfc, 0x0a, 0xe9, 0x35, 0xf4, 0xbd, 0x38, 0x14,
0xe9, 0x42, 0x5c, 0x7a, 0x70, 0x3b, 0xa5, 0x78, 0xf5, 0x90, 0x0d, 0x56, 0x62, 0x48, 0x62, 0x03, 0x3e, 0x66, 0x3c, 0x89, 0x33, 0x24, 0x67, 0xa0, 0x65, 0xb8, 0x4a, 0x51, 0xcc, 0xb1, 0x28, 0xbd,
0x3b, 0xcc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x40, 0x04, 0xea, 0x0a, 0xac, 0x00, 0x00, 0x00, 0x47, 0x81, 0x3e, 0x83, 0xe1, 0xe3, 0x36, 0xc0, 0x0d, 0x9f, 0x63, 0x21, 0x93, 0xff, 0x43, 0x87,
0xf1, 0xf0, 0x68, 0x2e, 0x69, 0x7f, 0x63, 0x94, 0xac, 0x58, 0xe4, 0x71, 0xab, 0x35, 0x52, 0xc7,
0x6d, 0xbf, 0x42, 0x62, 0x43, 0x6f, 0x9d, 0x64, 0xe2, 0x81, 0x6d, 0xd0, 0x6a, 0xcb, 0x7f, 0x6a,
0xa6, 0x73, 0xd0, 0x9b, 0xe1, 0x16, 0x74, 0xc5, 0x01, 0xab, 0xb1, 0x4b, 0x24, 0x14, 0xfa, 0x3c,
0x89, 0x22, 0x2f, 0x16, 0x98, 0xee, 0x58, 0x24, 0xef, 0x50, 0xfd, 0x13, 0x8d, 0x9e, 0x43, 0xb7,
0x0c, 0x23, 0xff, 0xe0, 0xef, 0x8e, 0x45, 0x39, 0x96, 0x31, 0x07, 0xa0, 0xdf, 0x00, 0x6e, 0x2e,
0xd6, 0x0b, 0xc1, 0x44, 0x9e, 0x11, 0x07, 0xfe, 0x88, 0x82, 0x1f, 0x2c, 0xc6, 0xc4, 0x76, 0x8e,
0x47, 0x8d, 0xcf, 0xa0, 0xe0, 0xe8, 0x4b, 0x1f, 0x75, 0xc1, 0x38, 0xd5, 0xc9, 0x00, 0x34, 0x77,
0x19, 0xdc, 0xbf, 0x3c, 0xb9, 0x5e, 0x60, 0x2a, 0x64, 0x08, 0xba, 0x44, 0x77, 0x3a, 0x9d, 0x3d,
0x06, 0xa6, 0x5a, 0x0b, 0xfe, 0xec, 0x6e, 0xb9, 0x98, 0x99, 0xad, 0xc9, 0x8f, 0x0a, 0xba, 0x57,
0x17, 0x97, 0x92, 0x2b, 0x80, 0x4c, 0xb0, 0x54, 0xc8, 0xe2, 0x08, 0x38, 0x75, 0x81, 0xf6, 0xc0,
0x69, 0xb6, 0x44, 0x15, 0x72, 0x03, 0x46, 0x8a, 0xdb, 0x1c, 0x33, 0x51, 0xed, 0x38, 0x74, 0x4e,
0xab, 0xb1, 0xfb, 0x4e, 0x83, 0xa8, 0x42, 0x2e, 0x40, 0x9b, 0xae, 0x71, 0xf5, 0xb9, 0x9f, 0x9a,
0xf4, 0xaa, 0x43, 0x5b, 0x6f, 0xac, 0x47, 0x95, 0xd7, 0x8e, 0x7c, 0x3e, 0xb7, 0xbf, 0x01, 0x00,
0x00, 0xff, 0xff, 0x04, 0xed, 0xfd, 0x0b, 0x52, 0x02, 0x00, 0x00,
} }

View File

@ -9,6 +9,33 @@ message InitResponse {
string secretKey = 1; string secretKey = 1;
} }
message ReqTempKeyInfo {
string apiKey = 1;
int64 localIp = 2;
string hostName = 3;
}
message TempKeyInfo {
string tempKey = 1;
double pollInterval = 2;
}
message TempKey {
string value = 1;
}
message AuthStatus {
enum AuthStatusType {
AUTH_WAIT = 0;
AUTH_ACCEPT = 1;
AUTH_REFUSE = 2;
}
AuthStatusType type = 1;
}
service Initializer { service Initializer {
rpc agentStarting(AgentInfo) returns (InitResponse) {} rpc startAgent(AgentInfo) returns (InitResponse) {}
rpc requestTempKey(ReqTempKeyInfo) returns (TempKeyInfo) {}
rpc CheckAuth(TempKey) returns (AuthStatus) {}
} }