github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/api/ca.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: github.com/docker/swarmkit/api/ca.proto 3 4 package api 5 6 import ( 7 context "context" 8 fmt "fmt" 9 github_com_docker_swarmkit_api_deepcopy "github.com/docker/swarmkit/api/deepcopy" 10 raftselector "github.com/docker/swarmkit/manager/raftselector" 11 _ "github.com/docker/swarmkit/protobuf/plugin" 12 _ "github.com/gogo/protobuf/gogoproto" 13 proto "github.com/gogo/protobuf/proto" 14 grpc "google.golang.org/grpc" 15 codes "google.golang.org/grpc/codes" 16 metadata "google.golang.org/grpc/metadata" 17 peer "google.golang.org/grpc/peer" 18 status "google.golang.org/grpc/status" 19 io "io" 20 math "math" 21 reflect "reflect" 22 strings "strings" 23 rafttime "time" 24 ) 25 26 // Reference imports to suppress errors if they are not otherwise used. 27 var _ = proto.Marshal 28 var _ = fmt.Errorf 29 var _ = math.Inf 30 31 // This is a compile-time assertion to ensure that this generated file 32 // is compatible with the proto package it is being compiled against. 33 // A compilation error at this line likely means your copy of the 34 // proto package needs to be updated. 35 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package 36 37 type NodeCertificateStatusRequest struct { 38 NodeID string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` 39 } 40 41 func (m *NodeCertificateStatusRequest) Reset() { *m = NodeCertificateStatusRequest{} } 42 func (*NodeCertificateStatusRequest) ProtoMessage() {} 43 func (*NodeCertificateStatusRequest) Descriptor() ([]byte, []int) { 44 return fileDescriptor_64a8db18191af608, []int{0} 45 } 46 func (m *NodeCertificateStatusRequest) XXX_Unmarshal(b []byte) error { 47 return m.Unmarshal(b) 48 } 49 func (m *NodeCertificateStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 50 if deterministic { 51 return xxx_messageInfo_NodeCertificateStatusRequest.Marshal(b, m, deterministic) 52 } else { 53 b = b[:cap(b)] 54 n, err := m.MarshalTo(b) 55 if err != nil { 56 return nil, err 57 } 58 return b[:n], nil 59 } 60 } 61 func (m *NodeCertificateStatusRequest) XXX_Merge(src proto.Message) { 62 xxx_messageInfo_NodeCertificateStatusRequest.Merge(m, src) 63 } 64 func (m *NodeCertificateStatusRequest) XXX_Size() int { 65 return m.Size() 66 } 67 func (m *NodeCertificateStatusRequest) XXX_DiscardUnknown() { 68 xxx_messageInfo_NodeCertificateStatusRequest.DiscardUnknown(m) 69 } 70 71 var xxx_messageInfo_NodeCertificateStatusRequest proto.InternalMessageInfo 72 73 type NodeCertificateStatusResponse struct { 74 Status *IssuanceStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` 75 Certificate *Certificate `protobuf:"bytes,2,opt,name=certificate,proto3" json:"certificate,omitempty"` 76 } 77 78 func (m *NodeCertificateStatusResponse) Reset() { *m = NodeCertificateStatusResponse{} } 79 func (*NodeCertificateStatusResponse) ProtoMessage() {} 80 func (*NodeCertificateStatusResponse) Descriptor() ([]byte, []int) { 81 return fileDescriptor_64a8db18191af608, []int{1} 82 } 83 func (m *NodeCertificateStatusResponse) XXX_Unmarshal(b []byte) error { 84 return m.Unmarshal(b) 85 } 86 func (m *NodeCertificateStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 87 if deterministic { 88 return xxx_messageInfo_NodeCertificateStatusResponse.Marshal(b, m, deterministic) 89 } else { 90 b = b[:cap(b)] 91 n, err := m.MarshalTo(b) 92 if err != nil { 93 return nil, err 94 } 95 return b[:n], nil 96 } 97 } 98 func (m *NodeCertificateStatusResponse) XXX_Merge(src proto.Message) { 99 xxx_messageInfo_NodeCertificateStatusResponse.Merge(m, src) 100 } 101 func (m *NodeCertificateStatusResponse) XXX_Size() int { 102 return m.Size() 103 } 104 func (m *NodeCertificateStatusResponse) XXX_DiscardUnknown() { 105 xxx_messageInfo_NodeCertificateStatusResponse.DiscardUnknown(m) 106 } 107 108 var xxx_messageInfo_NodeCertificateStatusResponse proto.InternalMessageInfo 109 110 type IssueNodeCertificateRequest struct { 111 // DEPRECATED: Role is now selected based on which secret is matched. 112 Role NodeRole `protobuf:"varint,1,opt,name=role,proto3,enum=docker.swarmkit.v1.NodeRole" json:"role,omitempty"` // Deprecated: Do not use. 113 // CSR is the certificate signing request. 114 CSR []byte `protobuf:"bytes,2,opt,name=csr,proto3" json:"csr,omitempty"` 115 // Token represents a user-provided string that is necessary for new 116 // nodes to join the cluster 117 Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` 118 // Availability allows a user to control the current scheduling status of a node 119 Availability NodeSpec_Availability `protobuf:"varint,4,opt,name=availability,proto3,enum=docker.swarmkit.v1.NodeSpec_Availability" json:"availability,omitempty"` 120 } 121 122 func (m *IssueNodeCertificateRequest) Reset() { *m = IssueNodeCertificateRequest{} } 123 func (*IssueNodeCertificateRequest) ProtoMessage() {} 124 func (*IssueNodeCertificateRequest) Descriptor() ([]byte, []int) { 125 return fileDescriptor_64a8db18191af608, []int{2} 126 } 127 func (m *IssueNodeCertificateRequest) XXX_Unmarshal(b []byte) error { 128 return m.Unmarshal(b) 129 } 130 func (m *IssueNodeCertificateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 131 if deterministic { 132 return xxx_messageInfo_IssueNodeCertificateRequest.Marshal(b, m, deterministic) 133 } else { 134 b = b[:cap(b)] 135 n, err := m.MarshalTo(b) 136 if err != nil { 137 return nil, err 138 } 139 return b[:n], nil 140 } 141 } 142 func (m *IssueNodeCertificateRequest) XXX_Merge(src proto.Message) { 143 xxx_messageInfo_IssueNodeCertificateRequest.Merge(m, src) 144 } 145 func (m *IssueNodeCertificateRequest) XXX_Size() int { 146 return m.Size() 147 } 148 func (m *IssueNodeCertificateRequest) XXX_DiscardUnknown() { 149 xxx_messageInfo_IssueNodeCertificateRequest.DiscardUnknown(m) 150 } 151 152 var xxx_messageInfo_IssueNodeCertificateRequest proto.InternalMessageInfo 153 154 type IssueNodeCertificateResponse struct { 155 NodeID string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` 156 NodeMembership NodeSpec_Membership `protobuf:"varint,2,opt,name=node_membership,json=nodeMembership,proto3,enum=docker.swarmkit.v1.NodeSpec_Membership" json:"node_membership,omitempty"` 157 } 158 159 func (m *IssueNodeCertificateResponse) Reset() { *m = IssueNodeCertificateResponse{} } 160 func (*IssueNodeCertificateResponse) ProtoMessage() {} 161 func (*IssueNodeCertificateResponse) Descriptor() ([]byte, []int) { 162 return fileDescriptor_64a8db18191af608, []int{3} 163 } 164 func (m *IssueNodeCertificateResponse) XXX_Unmarshal(b []byte) error { 165 return m.Unmarshal(b) 166 } 167 func (m *IssueNodeCertificateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 168 if deterministic { 169 return xxx_messageInfo_IssueNodeCertificateResponse.Marshal(b, m, deterministic) 170 } else { 171 b = b[:cap(b)] 172 n, err := m.MarshalTo(b) 173 if err != nil { 174 return nil, err 175 } 176 return b[:n], nil 177 } 178 } 179 func (m *IssueNodeCertificateResponse) XXX_Merge(src proto.Message) { 180 xxx_messageInfo_IssueNodeCertificateResponse.Merge(m, src) 181 } 182 func (m *IssueNodeCertificateResponse) XXX_Size() int { 183 return m.Size() 184 } 185 func (m *IssueNodeCertificateResponse) XXX_DiscardUnknown() { 186 xxx_messageInfo_IssueNodeCertificateResponse.DiscardUnknown(m) 187 } 188 189 var xxx_messageInfo_IssueNodeCertificateResponse proto.InternalMessageInfo 190 191 type GetRootCACertificateRequest struct { 192 } 193 194 func (m *GetRootCACertificateRequest) Reset() { *m = GetRootCACertificateRequest{} } 195 func (*GetRootCACertificateRequest) ProtoMessage() {} 196 func (*GetRootCACertificateRequest) Descriptor() ([]byte, []int) { 197 return fileDescriptor_64a8db18191af608, []int{4} 198 } 199 func (m *GetRootCACertificateRequest) XXX_Unmarshal(b []byte) error { 200 return m.Unmarshal(b) 201 } 202 func (m *GetRootCACertificateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 203 if deterministic { 204 return xxx_messageInfo_GetRootCACertificateRequest.Marshal(b, m, deterministic) 205 } else { 206 b = b[:cap(b)] 207 n, err := m.MarshalTo(b) 208 if err != nil { 209 return nil, err 210 } 211 return b[:n], nil 212 } 213 } 214 func (m *GetRootCACertificateRequest) XXX_Merge(src proto.Message) { 215 xxx_messageInfo_GetRootCACertificateRequest.Merge(m, src) 216 } 217 func (m *GetRootCACertificateRequest) XXX_Size() int { 218 return m.Size() 219 } 220 func (m *GetRootCACertificateRequest) XXX_DiscardUnknown() { 221 xxx_messageInfo_GetRootCACertificateRequest.DiscardUnknown(m) 222 } 223 224 var xxx_messageInfo_GetRootCACertificateRequest proto.InternalMessageInfo 225 226 type GetRootCACertificateResponse struct { 227 Certificate []byte `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"` 228 } 229 230 func (m *GetRootCACertificateResponse) Reset() { *m = GetRootCACertificateResponse{} } 231 func (*GetRootCACertificateResponse) ProtoMessage() {} 232 func (*GetRootCACertificateResponse) Descriptor() ([]byte, []int) { 233 return fileDescriptor_64a8db18191af608, []int{5} 234 } 235 func (m *GetRootCACertificateResponse) XXX_Unmarshal(b []byte) error { 236 return m.Unmarshal(b) 237 } 238 func (m *GetRootCACertificateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 239 if deterministic { 240 return xxx_messageInfo_GetRootCACertificateResponse.Marshal(b, m, deterministic) 241 } else { 242 b = b[:cap(b)] 243 n, err := m.MarshalTo(b) 244 if err != nil { 245 return nil, err 246 } 247 return b[:n], nil 248 } 249 } 250 func (m *GetRootCACertificateResponse) XXX_Merge(src proto.Message) { 251 xxx_messageInfo_GetRootCACertificateResponse.Merge(m, src) 252 } 253 func (m *GetRootCACertificateResponse) XXX_Size() int { 254 return m.Size() 255 } 256 func (m *GetRootCACertificateResponse) XXX_DiscardUnknown() { 257 xxx_messageInfo_GetRootCACertificateResponse.DiscardUnknown(m) 258 } 259 260 var xxx_messageInfo_GetRootCACertificateResponse proto.InternalMessageInfo 261 262 type GetUnlockKeyRequest struct { 263 } 264 265 func (m *GetUnlockKeyRequest) Reset() { *m = GetUnlockKeyRequest{} } 266 func (*GetUnlockKeyRequest) ProtoMessage() {} 267 func (*GetUnlockKeyRequest) Descriptor() ([]byte, []int) { 268 return fileDescriptor_64a8db18191af608, []int{6} 269 } 270 func (m *GetUnlockKeyRequest) XXX_Unmarshal(b []byte) error { 271 return m.Unmarshal(b) 272 } 273 func (m *GetUnlockKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 274 if deterministic { 275 return xxx_messageInfo_GetUnlockKeyRequest.Marshal(b, m, deterministic) 276 } else { 277 b = b[:cap(b)] 278 n, err := m.MarshalTo(b) 279 if err != nil { 280 return nil, err 281 } 282 return b[:n], nil 283 } 284 } 285 func (m *GetUnlockKeyRequest) XXX_Merge(src proto.Message) { 286 xxx_messageInfo_GetUnlockKeyRequest.Merge(m, src) 287 } 288 func (m *GetUnlockKeyRequest) XXX_Size() int { 289 return m.Size() 290 } 291 func (m *GetUnlockKeyRequest) XXX_DiscardUnknown() { 292 xxx_messageInfo_GetUnlockKeyRequest.DiscardUnknown(m) 293 } 294 295 var xxx_messageInfo_GetUnlockKeyRequest proto.InternalMessageInfo 296 297 type GetUnlockKeyResponse struct { 298 UnlockKey []byte `protobuf:"bytes,1,opt,name=unlock_key,json=unlockKey,proto3" json:"unlock_key,omitempty"` 299 Version Version `protobuf:"bytes,2,opt,name=version,proto3" json:"version"` 300 } 301 302 func (m *GetUnlockKeyResponse) Reset() { *m = GetUnlockKeyResponse{} } 303 func (*GetUnlockKeyResponse) ProtoMessage() {} 304 func (*GetUnlockKeyResponse) Descriptor() ([]byte, []int) { 305 return fileDescriptor_64a8db18191af608, []int{7} 306 } 307 func (m *GetUnlockKeyResponse) XXX_Unmarshal(b []byte) error { 308 return m.Unmarshal(b) 309 } 310 func (m *GetUnlockKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 311 if deterministic { 312 return xxx_messageInfo_GetUnlockKeyResponse.Marshal(b, m, deterministic) 313 } else { 314 b = b[:cap(b)] 315 n, err := m.MarshalTo(b) 316 if err != nil { 317 return nil, err 318 } 319 return b[:n], nil 320 } 321 } 322 func (m *GetUnlockKeyResponse) XXX_Merge(src proto.Message) { 323 xxx_messageInfo_GetUnlockKeyResponse.Merge(m, src) 324 } 325 func (m *GetUnlockKeyResponse) XXX_Size() int { 326 return m.Size() 327 } 328 func (m *GetUnlockKeyResponse) XXX_DiscardUnknown() { 329 xxx_messageInfo_GetUnlockKeyResponse.DiscardUnknown(m) 330 } 331 332 var xxx_messageInfo_GetUnlockKeyResponse proto.InternalMessageInfo 333 334 func init() { 335 proto.RegisterType((*NodeCertificateStatusRequest)(nil), "docker.swarmkit.v1.NodeCertificateStatusRequest") 336 proto.RegisterType((*NodeCertificateStatusResponse)(nil), "docker.swarmkit.v1.NodeCertificateStatusResponse") 337 proto.RegisterType((*IssueNodeCertificateRequest)(nil), "docker.swarmkit.v1.IssueNodeCertificateRequest") 338 proto.RegisterType((*IssueNodeCertificateResponse)(nil), "docker.swarmkit.v1.IssueNodeCertificateResponse") 339 proto.RegisterType((*GetRootCACertificateRequest)(nil), "docker.swarmkit.v1.GetRootCACertificateRequest") 340 proto.RegisterType((*GetRootCACertificateResponse)(nil), "docker.swarmkit.v1.GetRootCACertificateResponse") 341 proto.RegisterType((*GetUnlockKeyRequest)(nil), "docker.swarmkit.v1.GetUnlockKeyRequest") 342 proto.RegisterType((*GetUnlockKeyResponse)(nil), "docker.swarmkit.v1.GetUnlockKeyResponse") 343 } 344 345 func init() { 346 proto.RegisterFile("github.com/docker/swarmkit/api/ca.proto", fileDescriptor_64a8db18191af608) 347 } 348 349 var fileDescriptor_64a8db18191af608 = []byte{ 350 // 651 bytes of a gzipped FileDescriptorProto 351 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x4f, 0x13, 0x4f, 352 0x14, 0xee, 0x2c, 0xfc, 0xca, 0x8f, 0x47, 0x05, 0x33, 0x42, 0x52, 0x4b, 0xd9, 0x92, 0xd5, 0x04, 353 0x34, 0x71, 0x17, 0xaa, 0x89, 0x89, 0x5e, 0x6c, 0x6b, 0x42, 0x88, 0xc1, 0x98, 0x21, 0x7a, 0x25, 354 0xdb, 0xed, 0x50, 0x26, 0x6d, 0x77, 0xd6, 0x9d, 0x59, 0xb4, 0x37, 0x13, 0x8d, 0x67, 0x2f, 0x46, 355 0x4f, 0xfe, 0x09, 0xfe, 0x1d, 0xc4, 0x13, 0x89, 0x17, 0x4e, 0x44, 0x96, 0xbb, 0x7f, 0x83, 0xd9, 356 0xd9, 0x5d, 0x69, 0x61, 0x5b, 0xf0, 0xd4, 0x9d, 0xf7, 0xbe, 0xef, 0x7b, 0xef, 0x7d, 0xf3, 0x3a, 357 0xb0, 0xd2, 0x66, 0x72, 0x2f, 0x68, 0x9a, 0x0e, 0xef, 0x59, 0x2d, 0xee, 0x74, 0xa8, 0x6f, 0x89, 358 0x37, 0xb6, 0xdf, 0xeb, 0x30, 0x69, 0xd9, 0x1e, 0xb3, 0x1c, 0xdb, 0xf4, 0x7c, 0x2e, 0x39, 0xc6, 359 0x71, 0xd6, 0x4c, 0xb3, 0xe6, 0xfe, 0x7a, 0xe9, 0xee, 0x25, 0x64, 0xd9, 0xf7, 0xa8, 0x88, 0xf9, 360 0x97, 0x62, 0x85, 0x47, 0x9d, 0x14, 0x3b, 0xdf, 0xe6, 0x6d, 0xae, 0x3e, 0xad, 0xe8, 0x2b, 0x89, 361 0x3e, 0x1c, 0xa3, 0xa0, 0x10, 0xcd, 0x60, 0xd7, 0xf2, 0xba, 0x41, 0x9b, 0xb9, 0xc9, 0x4f, 0x4c, 362 0x34, 0x1a, 0x50, 0x7e, 0xce, 0x5b, 0xb4, 0x41, 0x7d, 0xc9, 0x76, 0x99, 0x63, 0x4b, 0xba, 0x2d, 363 0x6d, 0x19, 0x08, 0x42, 0x5f, 0x07, 0x54, 0x48, 0x7c, 0x0b, 0xa6, 0x5c, 0xde, 0xa2, 0x3b, 0xac, 364 0x55, 0x44, 0xcb, 0x68, 0x75, 0xba, 0x0e, 0xe1, 0x71, 0x25, 0x1f, 0x51, 0x36, 0x9f, 0x92, 0x7c, 365 0x94, 0xda, 0x6c, 0x19, 0xdf, 0x10, 0x2c, 0x8d, 0x50, 0x11, 0x1e, 0x77, 0x05, 0xc5, 0x8f, 0x20, 366 0x2f, 0x54, 0x44, 0xa9, 0xcc, 0x54, 0x0d, 0xf3, 0xa2, 0x65, 0xe6, 0xa6, 0x10, 0x81, 0xed, 0x3a, 367 0x29, 0x37, 0x61, 0xe0, 0x1a, 0xcc, 0x38, 0x67, 0xc2, 0x45, 0x4d, 0x09, 0x54, 0xb2, 0x04, 0x06, 368 0xea, 0x93, 0x41, 0x8e, 0xf1, 0x13, 0xc1, 0x62, 0xa4, 0x4e, 0xcf, 0x75, 0x99, 0x4e, 0xf9, 0x00, 369 0x26, 0x7d, 0xde, 0xa5, 0xaa, 0xb9, 0xd9, 0x6a, 0x39, 0x4b, 0x3b, 0x62, 0x12, 0xde, 0xa5, 0x75, 370 0xad, 0x88, 0x88, 0x42, 0xe3, 0x9b, 0x30, 0xe1, 0x08, 0x5f, 0x35, 0x54, 0xa8, 0x4f, 0x85, 0xc7, 371 0x95, 0x89, 0xc6, 0x36, 0x21, 0x51, 0x0c, 0xcf, 0xc3, 0x7f, 0x92, 0x77, 0xa8, 0x5b, 0x9c, 0x88, 372 0x4c, 0x23, 0xf1, 0x01, 0x6f, 0x41, 0xc1, 0xde, 0xb7, 0x59, 0xd7, 0x6e, 0xb2, 0x2e, 0x93, 0xfd, 373 0xe2, 0xa4, 0x2a, 0x77, 0x67, 0x54, 0xb9, 0x6d, 0x8f, 0x3a, 0x66, 0x6d, 0x80, 0x40, 0x86, 0xe8, 374 0xc6, 0x67, 0x04, 0xe5, 0xec, 0xa9, 0x12, 0xd7, 0xaf, 0x72, 0x79, 0xf8, 0x05, 0xcc, 0x29, 0x50, 375 0x8f, 0xf6, 0x9a, 0xd4, 0x17, 0x7b, 0xcc, 0x53, 0x13, 0xcd, 0x56, 0x57, 0xc6, 0xf6, 0xb5, 0xf5, 376 0x17, 0x4e, 0x66, 0x23, 0xfe, 0xd9, 0xd9, 0x58, 0x82, 0xc5, 0x0d, 0x2a, 0x09, 0xe7, 0xb2, 0x51, 377 0xbb, 0x68, 0xb6, 0xf1, 0x04, 0xca, 0xd9, 0xe9, 0xa4, 0xeb, 0xe5, 0xe1, 0xfb, 0x8e, 0x3a, 0x2f, 378 0x0c, 0x5f, 0xe7, 0x02, 0xdc, 0xd8, 0xa0, 0xf2, 0xa5, 0xdb, 0xe5, 0x4e, 0xe7, 0x19, 0xed, 0xa7, 379 0xc2, 0x3e, 0xcc, 0x0f, 0x87, 0x13, 0xc1, 0x25, 0x80, 0x40, 0x05, 0x77, 0x3a, 0xb4, 0x9f, 0xe8, 380 0x4d, 0x07, 0x29, 0x0c, 0x3f, 0x86, 0xa9, 0x7d, 0xea, 0x0b, 0xc6, 0xdd, 0x64, 0xb7, 0x16, 0xb3, 381 0x06, 0x7f, 0x15, 0x43, 0xea, 0x93, 0x07, 0xc7, 0x95, 0x1c, 0x49, 0x19, 0xd5, 0x0f, 0x1a, 0x68, 382 0x8d, 0x1a, 0x7e, 0x8f, 0x54, 0xed, 0x0b, 0x43, 0x61, 0x2b, 0x4b, 0x6b, 0x8c, 0x3b, 0xa5, 0xb5, 383 0xab, 0x13, 0xe2, 0xf1, 0x8c, 0xff, 0x7f, 0x7c, 0xff, 0xfd, 0x55, 0xd3, 0xae, 0x23, 0xfc, 0x16, 384 0x0a, 0x83, 0x06, 0xe0, 0x95, 0x11, 0x5a, 0xe7, 0x9d, 0x2b, 0xad, 0x5e, 0x0e, 0x4c, 0x8a, 0x2d, 385 0xa8, 0x62, 0x73, 0x70, 0x4d, 0x21, 0xef, 0xf5, 0x6c, 0xd7, 0x6e, 0x53, 0xbf, 0xfa, 0x45, 0x03, 386 0xb5, 0x57, 0x89, 0x15, 0x59, 0x5b, 0x99, 0x6d, 0xc5, 0x98, 0x7f, 0x65, 0xb6, 0x15, 0xe3, 0x16, 387 0x7e, 0xc0, 0x8a, 0x8f, 0x08, 0x16, 0x32, 0x9f, 0x24, 0xbc, 0x36, 0x6a, 0xad, 0x47, 0xbd, 0x81, 388 0xa5, 0xf5, 0x7f, 0x60, 0x9c, 0x6f, 0xa4, 0x7e, 0xfb, 0xe0, 0x44, 0xcf, 0x1d, 0x9d, 0xe8, 0xb9, 389 0x77, 0xa1, 0x8e, 0x0e, 0x42, 0x1d, 0x1d, 0x86, 0x3a, 0xfa, 0x15, 0xea, 0xe8, 0xd3, 0xa9, 0x9e, 390 0x3b, 0x3c, 0xd5, 0x73, 0x47, 0xa7, 0x7a, 0xae, 0x99, 0x57, 0xaf, 0xf1, 0xfd, 0x3f, 0x01, 0x00, 391 0x00, 0xff, 0xff, 0xd2, 0x82, 0x20, 0x1b, 0x73, 0x06, 0x00, 0x00, 392 } 393 394 type authenticatedWrapperCAServer struct { 395 local CAServer 396 authorize func(context.Context, []string) error 397 } 398 399 func NewAuthenticatedWrapperCAServer(local CAServer, authorize func(context.Context, []string) error) CAServer { 400 return &authenticatedWrapperCAServer{ 401 local: local, 402 authorize: authorize, 403 } 404 } 405 406 func (p *authenticatedWrapperCAServer) GetRootCACertificate(ctx context.Context, r *GetRootCACertificateRequest) (*GetRootCACertificateResponse, error) { 407 408 return p.local.GetRootCACertificate(ctx, r) 409 } 410 411 func (p *authenticatedWrapperCAServer) GetUnlockKey(ctx context.Context, r *GetUnlockKeyRequest) (*GetUnlockKeyResponse, error) { 412 413 if err := p.authorize(ctx, []string{"swarm-manager"}); err != nil { 414 return nil, err 415 } 416 return p.local.GetUnlockKey(ctx, r) 417 } 418 419 type authenticatedWrapperNodeCAServer struct { 420 local NodeCAServer 421 authorize func(context.Context, []string) error 422 } 423 424 func NewAuthenticatedWrapperNodeCAServer(local NodeCAServer, authorize func(context.Context, []string) error) NodeCAServer { 425 return &authenticatedWrapperNodeCAServer{ 426 local: local, 427 authorize: authorize, 428 } 429 } 430 431 func (p *authenticatedWrapperNodeCAServer) IssueNodeCertificate(ctx context.Context, r *IssueNodeCertificateRequest) (*IssueNodeCertificateResponse, error) { 432 433 return p.local.IssueNodeCertificate(ctx, r) 434 } 435 436 func (p *authenticatedWrapperNodeCAServer) NodeCertificateStatus(ctx context.Context, r *NodeCertificateStatusRequest) (*NodeCertificateStatusResponse, error) { 437 438 return p.local.NodeCertificateStatus(ctx, r) 439 } 440 441 func (m *NodeCertificateStatusRequest) Copy() *NodeCertificateStatusRequest { 442 if m == nil { 443 return nil 444 } 445 o := &NodeCertificateStatusRequest{} 446 o.CopyFrom(m) 447 return o 448 } 449 450 func (m *NodeCertificateStatusRequest) CopyFrom(src interface{}) { 451 452 o := src.(*NodeCertificateStatusRequest) 453 *m = *o 454 } 455 456 func (m *NodeCertificateStatusResponse) Copy() *NodeCertificateStatusResponse { 457 if m == nil { 458 return nil 459 } 460 o := &NodeCertificateStatusResponse{} 461 o.CopyFrom(m) 462 return o 463 } 464 465 func (m *NodeCertificateStatusResponse) CopyFrom(src interface{}) { 466 467 o := src.(*NodeCertificateStatusResponse) 468 *m = *o 469 if o.Status != nil { 470 m.Status = &IssuanceStatus{} 471 github_com_docker_swarmkit_api_deepcopy.Copy(m.Status, o.Status) 472 } 473 if o.Certificate != nil { 474 m.Certificate = &Certificate{} 475 github_com_docker_swarmkit_api_deepcopy.Copy(m.Certificate, o.Certificate) 476 } 477 } 478 479 func (m *IssueNodeCertificateRequest) Copy() *IssueNodeCertificateRequest { 480 if m == nil { 481 return nil 482 } 483 o := &IssueNodeCertificateRequest{} 484 o.CopyFrom(m) 485 return o 486 } 487 488 func (m *IssueNodeCertificateRequest) CopyFrom(src interface{}) { 489 490 o := src.(*IssueNodeCertificateRequest) 491 *m = *o 492 if o.CSR != nil { 493 m.CSR = make([]byte, len(o.CSR)) 494 copy(m.CSR, o.CSR) 495 } 496 } 497 498 func (m *IssueNodeCertificateResponse) Copy() *IssueNodeCertificateResponse { 499 if m == nil { 500 return nil 501 } 502 o := &IssueNodeCertificateResponse{} 503 o.CopyFrom(m) 504 return o 505 } 506 507 func (m *IssueNodeCertificateResponse) CopyFrom(src interface{}) { 508 509 o := src.(*IssueNodeCertificateResponse) 510 *m = *o 511 } 512 513 func (m *GetRootCACertificateRequest) Copy() *GetRootCACertificateRequest { 514 if m == nil { 515 return nil 516 } 517 o := &GetRootCACertificateRequest{} 518 o.CopyFrom(m) 519 return o 520 } 521 522 func (m *GetRootCACertificateRequest) CopyFrom(src interface{}) {} 523 func (m *GetRootCACertificateResponse) Copy() *GetRootCACertificateResponse { 524 if m == nil { 525 return nil 526 } 527 o := &GetRootCACertificateResponse{} 528 o.CopyFrom(m) 529 return o 530 } 531 532 func (m *GetRootCACertificateResponse) CopyFrom(src interface{}) { 533 534 o := src.(*GetRootCACertificateResponse) 535 *m = *o 536 if o.Certificate != nil { 537 m.Certificate = make([]byte, len(o.Certificate)) 538 copy(m.Certificate, o.Certificate) 539 } 540 } 541 542 func (m *GetUnlockKeyRequest) Copy() *GetUnlockKeyRequest { 543 if m == nil { 544 return nil 545 } 546 o := &GetUnlockKeyRequest{} 547 o.CopyFrom(m) 548 return o 549 } 550 551 func (m *GetUnlockKeyRequest) CopyFrom(src interface{}) {} 552 func (m *GetUnlockKeyResponse) Copy() *GetUnlockKeyResponse { 553 if m == nil { 554 return nil 555 } 556 o := &GetUnlockKeyResponse{} 557 o.CopyFrom(m) 558 return o 559 } 560 561 func (m *GetUnlockKeyResponse) CopyFrom(src interface{}) { 562 563 o := src.(*GetUnlockKeyResponse) 564 *m = *o 565 if o.UnlockKey != nil { 566 m.UnlockKey = make([]byte, len(o.UnlockKey)) 567 copy(m.UnlockKey, o.UnlockKey) 568 } 569 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Version, &o.Version) 570 } 571 572 // Reference imports to suppress errors if they are not otherwise used. 573 var _ context.Context 574 var _ grpc.ClientConn 575 576 // This is a compile-time assertion to ensure that this generated file 577 // is compatible with the grpc package it is being compiled against. 578 const _ = grpc.SupportPackageIsVersion4 579 580 // CAClient is the client API for CA service. 581 // 582 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 583 type CAClient interface { 584 GetRootCACertificate(ctx context.Context, in *GetRootCACertificateRequest, opts ...grpc.CallOption) (*GetRootCACertificateResponse, error) 585 // GetUnlockKey returns the current unlock key for the cluster for the role of the client 586 // asking. 587 GetUnlockKey(ctx context.Context, in *GetUnlockKeyRequest, opts ...grpc.CallOption) (*GetUnlockKeyResponse, error) 588 } 589 590 type cAClient struct { 591 cc *grpc.ClientConn 592 } 593 594 func NewCAClient(cc *grpc.ClientConn) CAClient { 595 return &cAClient{cc} 596 } 597 598 func (c *cAClient) GetRootCACertificate(ctx context.Context, in *GetRootCACertificateRequest, opts ...grpc.CallOption) (*GetRootCACertificateResponse, error) { 599 out := new(GetRootCACertificateResponse) 600 err := c.cc.Invoke(ctx, "/docker.swarmkit.v1.CA/GetRootCACertificate", in, out, opts...) 601 if err != nil { 602 return nil, err 603 } 604 return out, nil 605 } 606 607 func (c *cAClient) GetUnlockKey(ctx context.Context, in *GetUnlockKeyRequest, opts ...grpc.CallOption) (*GetUnlockKeyResponse, error) { 608 out := new(GetUnlockKeyResponse) 609 err := c.cc.Invoke(ctx, "/docker.swarmkit.v1.CA/GetUnlockKey", in, out, opts...) 610 if err != nil { 611 return nil, err 612 } 613 return out, nil 614 } 615 616 // CAServer is the server API for CA service. 617 type CAServer interface { 618 GetRootCACertificate(context.Context, *GetRootCACertificateRequest) (*GetRootCACertificateResponse, error) 619 // GetUnlockKey returns the current unlock key for the cluster for the role of the client 620 // asking. 621 GetUnlockKey(context.Context, *GetUnlockKeyRequest) (*GetUnlockKeyResponse, error) 622 } 623 624 func RegisterCAServer(s *grpc.Server, srv CAServer) { 625 s.RegisterService(&_CA_serviceDesc, srv) 626 } 627 628 func _CA_GetRootCACertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 629 in := new(GetRootCACertificateRequest) 630 if err := dec(in); err != nil { 631 return nil, err 632 } 633 if interceptor == nil { 634 return srv.(CAServer).GetRootCACertificate(ctx, in) 635 } 636 info := &grpc.UnaryServerInfo{ 637 Server: srv, 638 FullMethod: "/docker.swarmkit.v1.CA/GetRootCACertificate", 639 } 640 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 641 return srv.(CAServer).GetRootCACertificate(ctx, req.(*GetRootCACertificateRequest)) 642 } 643 return interceptor(ctx, in, info, handler) 644 } 645 646 func _CA_GetUnlockKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 647 in := new(GetUnlockKeyRequest) 648 if err := dec(in); err != nil { 649 return nil, err 650 } 651 if interceptor == nil { 652 return srv.(CAServer).GetUnlockKey(ctx, in) 653 } 654 info := &grpc.UnaryServerInfo{ 655 Server: srv, 656 FullMethod: "/docker.swarmkit.v1.CA/GetUnlockKey", 657 } 658 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 659 return srv.(CAServer).GetUnlockKey(ctx, req.(*GetUnlockKeyRequest)) 660 } 661 return interceptor(ctx, in, info, handler) 662 } 663 664 var _CA_serviceDesc = grpc.ServiceDesc{ 665 ServiceName: "docker.swarmkit.v1.CA", 666 HandlerType: (*CAServer)(nil), 667 Methods: []grpc.MethodDesc{ 668 { 669 MethodName: "GetRootCACertificate", 670 Handler: _CA_GetRootCACertificate_Handler, 671 }, 672 { 673 MethodName: "GetUnlockKey", 674 Handler: _CA_GetUnlockKey_Handler, 675 }, 676 }, 677 Streams: []grpc.StreamDesc{}, 678 Metadata: "github.com/docker/swarmkit/api/ca.proto", 679 } 680 681 // NodeCAClient is the client API for NodeCA service. 682 // 683 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 684 type NodeCAClient interface { 685 IssueNodeCertificate(ctx context.Context, in *IssueNodeCertificateRequest, opts ...grpc.CallOption) (*IssueNodeCertificateResponse, error) 686 NodeCertificateStatus(ctx context.Context, in *NodeCertificateStatusRequest, opts ...grpc.CallOption) (*NodeCertificateStatusResponse, error) 687 } 688 689 type nodeCAClient struct { 690 cc *grpc.ClientConn 691 } 692 693 func NewNodeCAClient(cc *grpc.ClientConn) NodeCAClient { 694 return &nodeCAClient{cc} 695 } 696 697 func (c *nodeCAClient) IssueNodeCertificate(ctx context.Context, in *IssueNodeCertificateRequest, opts ...grpc.CallOption) (*IssueNodeCertificateResponse, error) { 698 out := new(IssueNodeCertificateResponse) 699 err := c.cc.Invoke(ctx, "/docker.swarmkit.v1.NodeCA/IssueNodeCertificate", in, out, opts...) 700 if err != nil { 701 return nil, err 702 } 703 return out, nil 704 } 705 706 func (c *nodeCAClient) NodeCertificateStatus(ctx context.Context, in *NodeCertificateStatusRequest, opts ...grpc.CallOption) (*NodeCertificateStatusResponse, error) { 707 out := new(NodeCertificateStatusResponse) 708 err := c.cc.Invoke(ctx, "/docker.swarmkit.v1.NodeCA/NodeCertificateStatus", in, out, opts...) 709 if err != nil { 710 return nil, err 711 } 712 return out, nil 713 } 714 715 // NodeCAServer is the server API for NodeCA service. 716 type NodeCAServer interface { 717 IssueNodeCertificate(context.Context, *IssueNodeCertificateRequest) (*IssueNodeCertificateResponse, error) 718 NodeCertificateStatus(context.Context, *NodeCertificateStatusRequest) (*NodeCertificateStatusResponse, error) 719 } 720 721 func RegisterNodeCAServer(s *grpc.Server, srv NodeCAServer) { 722 s.RegisterService(&_NodeCA_serviceDesc, srv) 723 } 724 725 func _NodeCA_IssueNodeCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 726 in := new(IssueNodeCertificateRequest) 727 if err := dec(in); err != nil { 728 return nil, err 729 } 730 if interceptor == nil { 731 return srv.(NodeCAServer).IssueNodeCertificate(ctx, in) 732 } 733 info := &grpc.UnaryServerInfo{ 734 Server: srv, 735 FullMethod: "/docker.swarmkit.v1.NodeCA/IssueNodeCertificate", 736 } 737 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 738 return srv.(NodeCAServer).IssueNodeCertificate(ctx, req.(*IssueNodeCertificateRequest)) 739 } 740 return interceptor(ctx, in, info, handler) 741 } 742 743 func _NodeCA_NodeCertificateStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 744 in := new(NodeCertificateStatusRequest) 745 if err := dec(in); err != nil { 746 return nil, err 747 } 748 if interceptor == nil { 749 return srv.(NodeCAServer).NodeCertificateStatus(ctx, in) 750 } 751 info := &grpc.UnaryServerInfo{ 752 Server: srv, 753 FullMethod: "/docker.swarmkit.v1.NodeCA/NodeCertificateStatus", 754 } 755 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 756 return srv.(NodeCAServer).NodeCertificateStatus(ctx, req.(*NodeCertificateStatusRequest)) 757 } 758 return interceptor(ctx, in, info, handler) 759 } 760 761 var _NodeCA_serviceDesc = grpc.ServiceDesc{ 762 ServiceName: "docker.swarmkit.v1.NodeCA", 763 HandlerType: (*NodeCAServer)(nil), 764 Methods: []grpc.MethodDesc{ 765 { 766 MethodName: "IssueNodeCertificate", 767 Handler: _NodeCA_IssueNodeCertificate_Handler, 768 }, 769 { 770 MethodName: "NodeCertificateStatus", 771 Handler: _NodeCA_NodeCertificateStatus_Handler, 772 }, 773 }, 774 Streams: []grpc.StreamDesc{}, 775 Metadata: "github.com/docker/swarmkit/api/ca.proto", 776 } 777 778 func (m *NodeCertificateStatusRequest) Marshal() (dAtA []byte, err error) { 779 size := m.Size() 780 dAtA = make([]byte, size) 781 n, err := m.MarshalTo(dAtA) 782 if err != nil { 783 return nil, err 784 } 785 return dAtA[:n], nil 786 } 787 788 func (m *NodeCertificateStatusRequest) MarshalTo(dAtA []byte) (int, error) { 789 var i int 790 _ = i 791 var l int 792 _ = l 793 if len(m.NodeID) > 0 { 794 dAtA[i] = 0xa 795 i++ 796 i = encodeVarintCa(dAtA, i, uint64(len(m.NodeID))) 797 i += copy(dAtA[i:], m.NodeID) 798 } 799 return i, nil 800 } 801 802 func (m *NodeCertificateStatusResponse) Marshal() (dAtA []byte, err error) { 803 size := m.Size() 804 dAtA = make([]byte, size) 805 n, err := m.MarshalTo(dAtA) 806 if err != nil { 807 return nil, err 808 } 809 return dAtA[:n], nil 810 } 811 812 func (m *NodeCertificateStatusResponse) MarshalTo(dAtA []byte) (int, error) { 813 var i int 814 _ = i 815 var l int 816 _ = l 817 if m.Status != nil { 818 dAtA[i] = 0xa 819 i++ 820 i = encodeVarintCa(dAtA, i, uint64(m.Status.Size())) 821 n1, err := m.Status.MarshalTo(dAtA[i:]) 822 if err != nil { 823 return 0, err 824 } 825 i += n1 826 } 827 if m.Certificate != nil { 828 dAtA[i] = 0x12 829 i++ 830 i = encodeVarintCa(dAtA, i, uint64(m.Certificate.Size())) 831 n2, err := m.Certificate.MarshalTo(dAtA[i:]) 832 if err != nil { 833 return 0, err 834 } 835 i += n2 836 } 837 return i, nil 838 } 839 840 func (m *IssueNodeCertificateRequest) Marshal() (dAtA []byte, err error) { 841 size := m.Size() 842 dAtA = make([]byte, size) 843 n, err := m.MarshalTo(dAtA) 844 if err != nil { 845 return nil, err 846 } 847 return dAtA[:n], nil 848 } 849 850 func (m *IssueNodeCertificateRequest) MarshalTo(dAtA []byte) (int, error) { 851 var i int 852 _ = i 853 var l int 854 _ = l 855 if m.Role != 0 { 856 dAtA[i] = 0x8 857 i++ 858 i = encodeVarintCa(dAtA, i, uint64(m.Role)) 859 } 860 if len(m.CSR) > 0 { 861 dAtA[i] = 0x12 862 i++ 863 i = encodeVarintCa(dAtA, i, uint64(len(m.CSR))) 864 i += copy(dAtA[i:], m.CSR) 865 } 866 if len(m.Token) > 0 { 867 dAtA[i] = 0x1a 868 i++ 869 i = encodeVarintCa(dAtA, i, uint64(len(m.Token))) 870 i += copy(dAtA[i:], m.Token) 871 } 872 if m.Availability != 0 { 873 dAtA[i] = 0x20 874 i++ 875 i = encodeVarintCa(dAtA, i, uint64(m.Availability)) 876 } 877 return i, nil 878 } 879 880 func (m *IssueNodeCertificateResponse) Marshal() (dAtA []byte, err error) { 881 size := m.Size() 882 dAtA = make([]byte, size) 883 n, err := m.MarshalTo(dAtA) 884 if err != nil { 885 return nil, err 886 } 887 return dAtA[:n], nil 888 } 889 890 func (m *IssueNodeCertificateResponse) MarshalTo(dAtA []byte) (int, error) { 891 var i int 892 _ = i 893 var l int 894 _ = l 895 if len(m.NodeID) > 0 { 896 dAtA[i] = 0xa 897 i++ 898 i = encodeVarintCa(dAtA, i, uint64(len(m.NodeID))) 899 i += copy(dAtA[i:], m.NodeID) 900 } 901 if m.NodeMembership != 0 { 902 dAtA[i] = 0x10 903 i++ 904 i = encodeVarintCa(dAtA, i, uint64(m.NodeMembership)) 905 } 906 return i, nil 907 } 908 909 func (m *GetRootCACertificateRequest) Marshal() (dAtA []byte, err error) { 910 size := m.Size() 911 dAtA = make([]byte, size) 912 n, err := m.MarshalTo(dAtA) 913 if err != nil { 914 return nil, err 915 } 916 return dAtA[:n], nil 917 } 918 919 func (m *GetRootCACertificateRequest) MarshalTo(dAtA []byte) (int, error) { 920 var i int 921 _ = i 922 var l int 923 _ = l 924 return i, nil 925 } 926 927 func (m *GetRootCACertificateResponse) Marshal() (dAtA []byte, err error) { 928 size := m.Size() 929 dAtA = make([]byte, size) 930 n, err := m.MarshalTo(dAtA) 931 if err != nil { 932 return nil, err 933 } 934 return dAtA[:n], nil 935 } 936 937 func (m *GetRootCACertificateResponse) MarshalTo(dAtA []byte) (int, error) { 938 var i int 939 _ = i 940 var l int 941 _ = l 942 if len(m.Certificate) > 0 { 943 dAtA[i] = 0xa 944 i++ 945 i = encodeVarintCa(dAtA, i, uint64(len(m.Certificate))) 946 i += copy(dAtA[i:], m.Certificate) 947 } 948 return i, nil 949 } 950 951 func (m *GetUnlockKeyRequest) Marshal() (dAtA []byte, err error) { 952 size := m.Size() 953 dAtA = make([]byte, size) 954 n, err := m.MarshalTo(dAtA) 955 if err != nil { 956 return nil, err 957 } 958 return dAtA[:n], nil 959 } 960 961 func (m *GetUnlockKeyRequest) MarshalTo(dAtA []byte) (int, error) { 962 var i int 963 _ = i 964 var l int 965 _ = l 966 return i, nil 967 } 968 969 func (m *GetUnlockKeyResponse) Marshal() (dAtA []byte, err error) { 970 size := m.Size() 971 dAtA = make([]byte, size) 972 n, err := m.MarshalTo(dAtA) 973 if err != nil { 974 return nil, err 975 } 976 return dAtA[:n], nil 977 } 978 979 func (m *GetUnlockKeyResponse) MarshalTo(dAtA []byte) (int, error) { 980 var i int 981 _ = i 982 var l int 983 _ = l 984 if len(m.UnlockKey) > 0 { 985 dAtA[i] = 0xa 986 i++ 987 i = encodeVarintCa(dAtA, i, uint64(len(m.UnlockKey))) 988 i += copy(dAtA[i:], m.UnlockKey) 989 } 990 dAtA[i] = 0x12 991 i++ 992 i = encodeVarintCa(dAtA, i, uint64(m.Version.Size())) 993 n3, err := m.Version.MarshalTo(dAtA[i:]) 994 if err != nil { 995 return 0, err 996 } 997 i += n3 998 return i, nil 999 } 1000 1001 func encodeVarintCa(dAtA []byte, offset int, v uint64) int { 1002 for v >= 1<<7 { 1003 dAtA[offset] = uint8(v&0x7f | 0x80) 1004 v >>= 7 1005 offset++ 1006 } 1007 dAtA[offset] = uint8(v) 1008 return offset + 1 1009 } 1010 1011 type raftProxyCAServer struct { 1012 local CAServer 1013 connSelector raftselector.ConnProvider 1014 localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error) 1015 } 1016 1017 func NewRaftProxyCAServer(local CAServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) CAServer { 1018 redirectChecker := func(ctx context.Context) (context.Context, error) { 1019 p, ok := peer.FromContext(ctx) 1020 if !ok { 1021 return ctx, status.Errorf(codes.InvalidArgument, "remote addr is not found in context") 1022 } 1023 addr := p.Addr.String() 1024 md, ok := metadata.FromIncomingContext(ctx) 1025 if ok && len(md["redirect"]) != 0 { 1026 return ctx, status.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"]) 1027 } 1028 if !ok { 1029 md = metadata.New(map[string]string{}) 1030 } 1031 md["redirect"] = append(md["redirect"], addr) 1032 return metadata.NewOutgoingContext(ctx, md), nil 1033 } 1034 remoteMods := []func(context.Context) (context.Context, error){redirectChecker} 1035 remoteMods = append(remoteMods, remoteCtxMod) 1036 1037 var localMods []func(context.Context) (context.Context, error) 1038 if localCtxMod != nil { 1039 localMods = []func(context.Context) (context.Context, error){localCtxMod} 1040 } 1041 1042 return &raftProxyCAServer{ 1043 local: local, 1044 connSelector: connSelector, 1045 localCtxMods: localMods, 1046 remoteCtxMods: remoteMods, 1047 } 1048 } 1049 func (p *raftProxyCAServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) { 1050 var err error 1051 for _, mod := range ctxMods { 1052 ctx, err = mod(ctx) 1053 if err != nil { 1054 return ctx, err 1055 } 1056 } 1057 return ctx, nil 1058 } 1059 func (p *raftProxyCAServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) { 1060 ticker := rafttime.NewTicker(500 * rafttime.Millisecond) 1061 defer ticker.Stop() 1062 for { 1063 select { 1064 case <-ticker.C: 1065 conn, err := p.connSelector.LeaderConn(ctx) 1066 if err != nil { 1067 return nil, err 1068 } 1069 1070 client := NewHealthClient(conn) 1071 1072 resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"}) 1073 if err != nil || resp.Status != HealthCheckResponse_SERVING { 1074 continue 1075 } 1076 return conn, nil 1077 case <-ctx.Done(): 1078 return nil, ctx.Err() 1079 } 1080 } 1081 } 1082 1083 func (p *raftProxyCAServer) GetRootCACertificate(ctx context.Context, r *GetRootCACertificateRequest) (*GetRootCACertificateResponse, error) { 1084 1085 conn, err := p.connSelector.LeaderConn(ctx) 1086 if err != nil { 1087 if err == raftselector.ErrIsLeader { 1088 ctx, err = p.runCtxMods(ctx, p.localCtxMods) 1089 if err != nil { 1090 return nil, err 1091 } 1092 return p.local.GetRootCACertificate(ctx, r) 1093 } 1094 return nil, err 1095 } 1096 modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods) 1097 if err != nil { 1098 return nil, err 1099 } 1100 1101 resp, err := NewCAClient(conn).GetRootCACertificate(modCtx, r) 1102 if err != nil { 1103 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") { 1104 return resp, err 1105 } 1106 conn, err := p.pollNewLeaderConn(ctx) 1107 if err != nil { 1108 if err == raftselector.ErrIsLeader { 1109 return p.local.GetRootCACertificate(ctx, r) 1110 } 1111 return nil, err 1112 } 1113 return NewCAClient(conn).GetRootCACertificate(modCtx, r) 1114 } 1115 return resp, err 1116 } 1117 1118 func (p *raftProxyCAServer) GetUnlockKey(ctx context.Context, r *GetUnlockKeyRequest) (*GetUnlockKeyResponse, error) { 1119 1120 conn, err := p.connSelector.LeaderConn(ctx) 1121 if err != nil { 1122 if err == raftselector.ErrIsLeader { 1123 ctx, err = p.runCtxMods(ctx, p.localCtxMods) 1124 if err != nil { 1125 return nil, err 1126 } 1127 return p.local.GetUnlockKey(ctx, r) 1128 } 1129 return nil, err 1130 } 1131 modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods) 1132 if err != nil { 1133 return nil, err 1134 } 1135 1136 resp, err := NewCAClient(conn).GetUnlockKey(modCtx, r) 1137 if err != nil { 1138 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") { 1139 return resp, err 1140 } 1141 conn, err := p.pollNewLeaderConn(ctx) 1142 if err != nil { 1143 if err == raftselector.ErrIsLeader { 1144 return p.local.GetUnlockKey(ctx, r) 1145 } 1146 return nil, err 1147 } 1148 return NewCAClient(conn).GetUnlockKey(modCtx, r) 1149 } 1150 return resp, err 1151 } 1152 1153 type raftProxyNodeCAServer struct { 1154 local NodeCAServer 1155 connSelector raftselector.ConnProvider 1156 localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error) 1157 } 1158 1159 func NewRaftProxyNodeCAServer(local NodeCAServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) NodeCAServer { 1160 redirectChecker := func(ctx context.Context) (context.Context, error) { 1161 p, ok := peer.FromContext(ctx) 1162 if !ok { 1163 return ctx, status.Errorf(codes.InvalidArgument, "remote addr is not found in context") 1164 } 1165 addr := p.Addr.String() 1166 md, ok := metadata.FromIncomingContext(ctx) 1167 if ok && len(md["redirect"]) != 0 { 1168 return ctx, status.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"]) 1169 } 1170 if !ok { 1171 md = metadata.New(map[string]string{}) 1172 } 1173 md["redirect"] = append(md["redirect"], addr) 1174 return metadata.NewOutgoingContext(ctx, md), nil 1175 } 1176 remoteMods := []func(context.Context) (context.Context, error){redirectChecker} 1177 remoteMods = append(remoteMods, remoteCtxMod) 1178 1179 var localMods []func(context.Context) (context.Context, error) 1180 if localCtxMod != nil { 1181 localMods = []func(context.Context) (context.Context, error){localCtxMod} 1182 } 1183 1184 return &raftProxyNodeCAServer{ 1185 local: local, 1186 connSelector: connSelector, 1187 localCtxMods: localMods, 1188 remoteCtxMods: remoteMods, 1189 } 1190 } 1191 func (p *raftProxyNodeCAServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) { 1192 var err error 1193 for _, mod := range ctxMods { 1194 ctx, err = mod(ctx) 1195 if err != nil { 1196 return ctx, err 1197 } 1198 } 1199 return ctx, nil 1200 } 1201 func (p *raftProxyNodeCAServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) { 1202 ticker := rafttime.NewTicker(500 * rafttime.Millisecond) 1203 defer ticker.Stop() 1204 for { 1205 select { 1206 case <-ticker.C: 1207 conn, err := p.connSelector.LeaderConn(ctx) 1208 if err != nil { 1209 return nil, err 1210 } 1211 1212 client := NewHealthClient(conn) 1213 1214 resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"}) 1215 if err != nil || resp.Status != HealthCheckResponse_SERVING { 1216 continue 1217 } 1218 return conn, nil 1219 case <-ctx.Done(): 1220 return nil, ctx.Err() 1221 } 1222 } 1223 } 1224 1225 func (p *raftProxyNodeCAServer) IssueNodeCertificate(ctx context.Context, r *IssueNodeCertificateRequest) (*IssueNodeCertificateResponse, error) { 1226 1227 conn, err := p.connSelector.LeaderConn(ctx) 1228 if err != nil { 1229 if err == raftselector.ErrIsLeader { 1230 ctx, err = p.runCtxMods(ctx, p.localCtxMods) 1231 if err != nil { 1232 return nil, err 1233 } 1234 return p.local.IssueNodeCertificate(ctx, r) 1235 } 1236 return nil, err 1237 } 1238 modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods) 1239 if err != nil { 1240 return nil, err 1241 } 1242 1243 resp, err := NewNodeCAClient(conn).IssueNodeCertificate(modCtx, r) 1244 if err != nil { 1245 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") { 1246 return resp, err 1247 } 1248 conn, err := p.pollNewLeaderConn(ctx) 1249 if err != nil { 1250 if err == raftselector.ErrIsLeader { 1251 return p.local.IssueNodeCertificate(ctx, r) 1252 } 1253 return nil, err 1254 } 1255 return NewNodeCAClient(conn).IssueNodeCertificate(modCtx, r) 1256 } 1257 return resp, err 1258 } 1259 1260 func (p *raftProxyNodeCAServer) NodeCertificateStatus(ctx context.Context, r *NodeCertificateStatusRequest) (*NodeCertificateStatusResponse, error) { 1261 1262 conn, err := p.connSelector.LeaderConn(ctx) 1263 if err != nil { 1264 if err == raftselector.ErrIsLeader { 1265 ctx, err = p.runCtxMods(ctx, p.localCtxMods) 1266 if err != nil { 1267 return nil, err 1268 } 1269 return p.local.NodeCertificateStatus(ctx, r) 1270 } 1271 return nil, err 1272 } 1273 modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods) 1274 if err != nil { 1275 return nil, err 1276 } 1277 1278 resp, err := NewNodeCAClient(conn).NodeCertificateStatus(modCtx, r) 1279 if err != nil { 1280 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") { 1281 return resp, err 1282 } 1283 conn, err := p.pollNewLeaderConn(ctx) 1284 if err != nil { 1285 if err == raftselector.ErrIsLeader { 1286 return p.local.NodeCertificateStatus(ctx, r) 1287 } 1288 return nil, err 1289 } 1290 return NewNodeCAClient(conn).NodeCertificateStatus(modCtx, r) 1291 } 1292 return resp, err 1293 } 1294 1295 func (m *NodeCertificateStatusRequest) Size() (n int) { 1296 if m == nil { 1297 return 0 1298 } 1299 var l int 1300 _ = l 1301 l = len(m.NodeID) 1302 if l > 0 { 1303 n += 1 + l + sovCa(uint64(l)) 1304 } 1305 return n 1306 } 1307 1308 func (m *NodeCertificateStatusResponse) Size() (n int) { 1309 if m == nil { 1310 return 0 1311 } 1312 var l int 1313 _ = l 1314 if m.Status != nil { 1315 l = m.Status.Size() 1316 n += 1 + l + sovCa(uint64(l)) 1317 } 1318 if m.Certificate != nil { 1319 l = m.Certificate.Size() 1320 n += 1 + l + sovCa(uint64(l)) 1321 } 1322 return n 1323 } 1324 1325 func (m *IssueNodeCertificateRequest) Size() (n int) { 1326 if m == nil { 1327 return 0 1328 } 1329 var l int 1330 _ = l 1331 if m.Role != 0 { 1332 n += 1 + sovCa(uint64(m.Role)) 1333 } 1334 l = len(m.CSR) 1335 if l > 0 { 1336 n += 1 + l + sovCa(uint64(l)) 1337 } 1338 l = len(m.Token) 1339 if l > 0 { 1340 n += 1 + l + sovCa(uint64(l)) 1341 } 1342 if m.Availability != 0 { 1343 n += 1 + sovCa(uint64(m.Availability)) 1344 } 1345 return n 1346 } 1347 1348 func (m *IssueNodeCertificateResponse) Size() (n int) { 1349 if m == nil { 1350 return 0 1351 } 1352 var l int 1353 _ = l 1354 l = len(m.NodeID) 1355 if l > 0 { 1356 n += 1 + l + sovCa(uint64(l)) 1357 } 1358 if m.NodeMembership != 0 { 1359 n += 1 + sovCa(uint64(m.NodeMembership)) 1360 } 1361 return n 1362 } 1363 1364 func (m *GetRootCACertificateRequest) Size() (n int) { 1365 if m == nil { 1366 return 0 1367 } 1368 var l int 1369 _ = l 1370 return n 1371 } 1372 1373 func (m *GetRootCACertificateResponse) Size() (n int) { 1374 if m == nil { 1375 return 0 1376 } 1377 var l int 1378 _ = l 1379 l = len(m.Certificate) 1380 if l > 0 { 1381 n += 1 + l + sovCa(uint64(l)) 1382 } 1383 return n 1384 } 1385 1386 func (m *GetUnlockKeyRequest) Size() (n int) { 1387 if m == nil { 1388 return 0 1389 } 1390 var l int 1391 _ = l 1392 return n 1393 } 1394 1395 func (m *GetUnlockKeyResponse) Size() (n int) { 1396 if m == nil { 1397 return 0 1398 } 1399 var l int 1400 _ = l 1401 l = len(m.UnlockKey) 1402 if l > 0 { 1403 n += 1 + l + sovCa(uint64(l)) 1404 } 1405 l = m.Version.Size() 1406 n += 1 + l + sovCa(uint64(l)) 1407 return n 1408 } 1409 1410 func sovCa(x uint64) (n int) { 1411 for { 1412 n++ 1413 x >>= 7 1414 if x == 0 { 1415 break 1416 } 1417 } 1418 return n 1419 } 1420 func sozCa(x uint64) (n int) { 1421 return sovCa(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 1422 } 1423 func (this *NodeCertificateStatusRequest) String() string { 1424 if this == nil { 1425 return "nil" 1426 } 1427 s := strings.Join([]string{`&NodeCertificateStatusRequest{`, 1428 `NodeID:` + fmt.Sprintf("%v", this.NodeID) + `,`, 1429 `}`, 1430 }, "") 1431 return s 1432 } 1433 func (this *NodeCertificateStatusResponse) String() string { 1434 if this == nil { 1435 return "nil" 1436 } 1437 s := strings.Join([]string{`&NodeCertificateStatusResponse{`, 1438 `Status:` + strings.Replace(fmt.Sprintf("%v", this.Status), "IssuanceStatus", "IssuanceStatus", 1) + `,`, 1439 `Certificate:` + strings.Replace(fmt.Sprintf("%v", this.Certificate), "Certificate", "Certificate", 1) + `,`, 1440 `}`, 1441 }, "") 1442 return s 1443 } 1444 func (this *IssueNodeCertificateRequest) String() string { 1445 if this == nil { 1446 return "nil" 1447 } 1448 s := strings.Join([]string{`&IssueNodeCertificateRequest{`, 1449 `Role:` + fmt.Sprintf("%v", this.Role) + `,`, 1450 `CSR:` + fmt.Sprintf("%v", this.CSR) + `,`, 1451 `Token:` + fmt.Sprintf("%v", this.Token) + `,`, 1452 `Availability:` + fmt.Sprintf("%v", this.Availability) + `,`, 1453 `}`, 1454 }, "") 1455 return s 1456 } 1457 func (this *IssueNodeCertificateResponse) String() string { 1458 if this == nil { 1459 return "nil" 1460 } 1461 s := strings.Join([]string{`&IssueNodeCertificateResponse{`, 1462 `NodeID:` + fmt.Sprintf("%v", this.NodeID) + `,`, 1463 `NodeMembership:` + fmt.Sprintf("%v", this.NodeMembership) + `,`, 1464 `}`, 1465 }, "") 1466 return s 1467 } 1468 func (this *GetRootCACertificateRequest) String() string { 1469 if this == nil { 1470 return "nil" 1471 } 1472 s := strings.Join([]string{`&GetRootCACertificateRequest{`, 1473 `}`, 1474 }, "") 1475 return s 1476 } 1477 func (this *GetRootCACertificateResponse) String() string { 1478 if this == nil { 1479 return "nil" 1480 } 1481 s := strings.Join([]string{`&GetRootCACertificateResponse{`, 1482 `Certificate:` + fmt.Sprintf("%v", this.Certificate) + `,`, 1483 `}`, 1484 }, "") 1485 return s 1486 } 1487 func (this *GetUnlockKeyRequest) String() string { 1488 if this == nil { 1489 return "nil" 1490 } 1491 s := strings.Join([]string{`&GetUnlockKeyRequest{`, 1492 `}`, 1493 }, "") 1494 return s 1495 } 1496 func (this *GetUnlockKeyResponse) String() string { 1497 if this == nil { 1498 return "nil" 1499 } 1500 s := strings.Join([]string{`&GetUnlockKeyResponse{`, 1501 `UnlockKey:` + fmt.Sprintf("%v", this.UnlockKey) + `,`, 1502 `Version:` + strings.Replace(strings.Replace(this.Version.String(), "Version", "Version", 1), `&`, ``, 1) + `,`, 1503 `}`, 1504 }, "") 1505 return s 1506 } 1507 func valueToStringCa(v interface{}) string { 1508 rv := reflect.ValueOf(v) 1509 if rv.IsNil() { 1510 return "nil" 1511 } 1512 pv := reflect.Indirect(rv).Interface() 1513 return fmt.Sprintf("*%v", pv) 1514 } 1515 func (m *NodeCertificateStatusRequest) Unmarshal(dAtA []byte) error { 1516 l := len(dAtA) 1517 iNdEx := 0 1518 for iNdEx < l { 1519 preIndex := iNdEx 1520 var wire uint64 1521 for shift := uint(0); ; shift += 7 { 1522 if shift >= 64 { 1523 return ErrIntOverflowCa 1524 } 1525 if iNdEx >= l { 1526 return io.ErrUnexpectedEOF 1527 } 1528 b := dAtA[iNdEx] 1529 iNdEx++ 1530 wire |= uint64(b&0x7F) << shift 1531 if b < 0x80 { 1532 break 1533 } 1534 } 1535 fieldNum := int32(wire >> 3) 1536 wireType := int(wire & 0x7) 1537 if wireType == 4 { 1538 return fmt.Errorf("proto: NodeCertificateStatusRequest: wiretype end group for non-group") 1539 } 1540 if fieldNum <= 0 { 1541 return fmt.Errorf("proto: NodeCertificateStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) 1542 } 1543 switch fieldNum { 1544 case 1: 1545 if wireType != 2 { 1546 return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) 1547 } 1548 var stringLen uint64 1549 for shift := uint(0); ; shift += 7 { 1550 if shift >= 64 { 1551 return ErrIntOverflowCa 1552 } 1553 if iNdEx >= l { 1554 return io.ErrUnexpectedEOF 1555 } 1556 b := dAtA[iNdEx] 1557 iNdEx++ 1558 stringLen |= uint64(b&0x7F) << shift 1559 if b < 0x80 { 1560 break 1561 } 1562 } 1563 intStringLen := int(stringLen) 1564 if intStringLen < 0 { 1565 return ErrInvalidLengthCa 1566 } 1567 postIndex := iNdEx + intStringLen 1568 if postIndex < 0 { 1569 return ErrInvalidLengthCa 1570 } 1571 if postIndex > l { 1572 return io.ErrUnexpectedEOF 1573 } 1574 m.NodeID = string(dAtA[iNdEx:postIndex]) 1575 iNdEx = postIndex 1576 default: 1577 iNdEx = preIndex 1578 skippy, err := skipCa(dAtA[iNdEx:]) 1579 if err != nil { 1580 return err 1581 } 1582 if skippy < 0 { 1583 return ErrInvalidLengthCa 1584 } 1585 if (iNdEx + skippy) < 0 { 1586 return ErrInvalidLengthCa 1587 } 1588 if (iNdEx + skippy) > l { 1589 return io.ErrUnexpectedEOF 1590 } 1591 iNdEx += skippy 1592 } 1593 } 1594 1595 if iNdEx > l { 1596 return io.ErrUnexpectedEOF 1597 } 1598 return nil 1599 } 1600 func (m *NodeCertificateStatusResponse) Unmarshal(dAtA []byte) error { 1601 l := len(dAtA) 1602 iNdEx := 0 1603 for iNdEx < l { 1604 preIndex := iNdEx 1605 var wire uint64 1606 for shift := uint(0); ; shift += 7 { 1607 if shift >= 64 { 1608 return ErrIntOverflowCa 1609 } 1610 if iNdEx >= l { 1611 return io.ErrUnexpectedEOF 1612 } 1613 b := dAtA[iNdEx] 1614 iNdEx++ 1615 wire |= uint64(b&0x7F) << shift 1616 if b < 0x80 { 1617 break 1618 } 1619 } 1620 fieldNum := int32(wire >> 3) 1621 wireType := int(wire & 0x7) 1622 if wireType == 4 { 1623 return fmt.Errorf("proto: NodeCertificateStatusResponse: wiretype end group for non-group") 1624 } 1625 if fieldNum <= 0 { 1626 return fmt.Errorf("proto: NodeCertificateStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) 1627 } 1628 switch fieldNum { 1629 case 1: 1630 if wireType != 2 { 1631 return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) 1632 } 1633 var msglen int 1634 for shift := uint(0); ; shift += 7 { 1635 if shift >= 64 { 1636 return ErrIntOverflowCa 1637 } 1638 if iNdEx >= l { 1639 return io.ErrUnexpectedEOF 1640 } 1641 b := dAtA[iNdEx] 1642 iNdEx++ 1643 msglen |= int(b&0x7F) << shift 1644 if b < 0x80 { 1645 break 1646 } 1647 } 1648 if msglen < 0 { 1649 return ErrInvalidLengthCa 1650 } 1651 postIndex := iNdEx + msglen 1652 if postIndex < 0 { 1653 return ErrInvalidLengthCa 1654 } 1655 if postIndex > l { 1656 return io.ErrUnexpectedEOF 1657 } 1658 if m.Status == nil { 1659 m.Status = &IssuanceStatus{} 1660 } 1661 if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1662 return err 1663 } 1664 iNdEx = postIndex 1665 case 2: 1666 if wireType != 2 { 1667 return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) 1668 } 1669 var msglen int 1670 for shift := uint(0); ; shift += 7 { 1671 if shift >= 64 { 1672 return ErrIntOverflowCa 1673 } 1674 if iNdEx >= l { 1675 return io.ErrUnexpectedEOF 1676 } 1677 b := dAtA[iNdEx] 1678 iNdEx++ 1679 msglen |= int(b&0x7F) << shift 1680 if b < 0x80 { 1681 break 1682 } 1683 } 1684 if msglen < 0 { 1685 return ErrInvalidLengthCa 1686 } 1687 postIndex := iNdEx + msglen 1688 if postIndex < 0 { 1689 return ErrInvalidLengthCa 1690 } 1691 if postIndex > l { 1692 return io.ErrUnexpectedEOF 1693 } 1694 if m.Certificate == nil { 1695 m.Certificate = &Certificate{} 1696 } 1697 if err := m.Certificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1698 return err 1699 } 1700 iNdEx = postIndex 1701 default: 1702 iNdEx = preIndex 1703 skippy, err := skipCa(dAtA[iNdEx:]) 1704 if err != nil { 1705 return err 1706 } 1707 if skippy < 0 { 1708 return ErrInvalidLengthCa 1709 } 1710 if (iNdEx + skippy) < 0 { 1711 return ErrInvalidLengthCa 1712 } 1713 if (iNdEx + skippy) > l { 1714 return io.ErrUnexpectedEOF 1715 } 1716 iNdEx += skippy 1717 } 1718 } 1719 1720 if iNdEx > l { 1721 return io.ErrUnexpectedEOF 1722 } 1723 return nil 1724 } 1725 func (m *IssueNodeCertificateRequest) Unmarshal(dAtA []byte) error { 1726 l := len(dAtA) 1727 iNdEx := 0 1728 for iNdEx < l { 1729 preIndex := iNdEx 1730 var wire uint64 1731 for shift := uint(0); ; shift += 7 { 1732 if shift >= 64 { 1733 return ErrIntOverflowCa 1734 } 1735 if iNdEx >= l { 1736 return io.ErrUnexpectedEOF 1737 } 1738 b := dAtA[iNdEx] 1739 iNdEx++ 1740 wire |= uint64(b&0x7F) << shift 1741 if b < 0x80 { 1742 break 1743 } 1744 } 1745 fieldNum := int32(wire >> 3) 1746 wireType := int(wire & 0x7) 1747 if wireType == 4 { 1748 return fmt.Errorf("proto: IssueNodeCertificateRequest: wiretype end group for non-group") 1749 } 1750 if fieldNum <= 0 { 1751 return fmt.Errorf("proto: IssueNodeCertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) 1752 } 1753 switch fieldNum { 1754 case 1: 1755 if wireType != 0 { 1756 return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) 1757 } 1758 m.Role = 0 1759 for shift := uint(0); ; shift += 7 { 1760 if shift >= 64 { 1761 return ErrIntOverflowCa 1762 } 1763 if iNdEx >= l { 1764 return io.ErrUnexpectedEOF 1765 } 1766 b := dAtA[iNdEx] 1767 iNdEx++ 1768 m.Role |= NodeRole(b&0x7F) << shift 1769 if b < 0x80 { 1770 break 1771 } 1772 } 1773 case 2: 1774 if wireType != 2 { 1775 return fmt.Errorf("proto: wrong wireType = %d for field CSR", wireType) 1776 } 1777 var byteLen int 1778 for shift := uint(0); ; shift += 7 { 1779 if shift >= 64 { 1780 return ErrIntOverflowCa 1781 } 1782 if iNdEx >= l { 1783 return io.ErrUnexpectedEOF 1784 } 1785 b := dAtA[iNdEx] 1786 iNdEx++ 1787 byteLen |= int(b&0x7F) << shift 1788 if b < 0x80 { 1789 break 1790 } 1791 } 1792 if byteLen < 0 { 1793 return ErrInvalidLengthCa 1794 } 1795 postIndex := iNdEx + byteLen 1796 if postIndex < 0 { 1797 return ErrInvalidLengthCa 1798 } 1799 if postIndex > l { 1800 return io.ErrUnexpectedEOF 1801 } 1802 m.CSR = append(m.CSR[:0], dAtA[iNdEx:postIndex]...) 1803 if m.CSR == nil { 1804 m.CSR = []byte{} 1805 } 1806 iNdEx = postIndex 1807 case 3: 1808 if wireType != 2 { 1809 return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) 1810 } 1811 var stringLen uint64 1812 for shift := uint(0); ; shift += 7 { 1813 if shift >= 64 { 1814 return ErrIntOverflowCa 1815 } 1816 if iNdEx >= l { 1817 return io.ErrUnexpectedEOF 1818 } 1819 b := dAtA[iNdEx] 1820 iNdEx++ 1821 stringLen |= uint64(b&0x7F) << shift 1822 if b < 0x80 { 1823 break 1824 } 1825 } 1826 intStringLen := int(stringLen) 1827 if intStringLen < 0 { 1828 return ErrInvalidLengthCa 1829 } 1830 postIndex := iNdEx + intStringLen 1831 if postIndex < 0 { 1832 return ErrInvalidLengthCa 1833 } 1834 if postIndex > l { 1835 return io.ErrUnexpectedEOF 1836 } 1837 m.Token = string(dAtA[iNdEx:postIndex]) 1838 iNdEx = postIndex 1839 case 4: 1840 if wireType != 0 { 1841 return fmt.Errorf("proto: wrong wireType = %d for field Availability", wireType) 1842 } 1843 m.Availability = 0 1844 for shift := uint(0); ; shift += 7 { 1845 if shift >= 64 { 1846 return ErrIntOverflowCa 1847 } 1848 if iNdEx >= l { 1849 return io.ErrUnexpectedEOF 1850 } 1851 b := dAtA[iNdEx] 1852 iNdEx++ 1853 m.Availability |= NodeSpec_Availability(b&0x7F) << shift 1854 if b < 0x80 { 1855 break 1856 } 1857 } 1858 default: 1859 iNdEx = preIndex 1860 skippy, err := skipCa(dAtA[iNdEx:]) 1861 if err != nil { 1862 return err 1863 } 1864 if skippy < 0 { 1865 return ErrInvalidLengthCa 1866 } 1867 if (iNdEx + skippy) < 0 { 1868 return ErrInvalidLengthCa 1869 } 1870 if (iNdEx + skippy) > l { 1871 return io.ErrUnexpectedEOF 1872 } 1873 iNdEx += skippy 1874 } 1875 } 1876 1877 if iNdEx > l { 1878 return io.ErrUnexpectedEOF 1879 } 1880 return nil 1881 } 1882 func (m *IssueNodeCertificateResponse) Unmarshal(dAtA []byte) error { 1883 l := len(dAtA) 1884 iNdEx := 0 1885 for iNdEx < l { 1886 preIndex := iNdEx 1887 var wire uint64 1888 for shift := uint(0); ; shift += 7 { 1889 if shift >= 64 { 1890 return ErrIntOverflowCa 1891 } 1892 if iNdEx >= l { 1893 return io.ErrUnexpectedEOF 1894 } 1895 b := dAtA[iNdEx] 1896 iNdEx++ 1897 wire |= uint64(b&0x7F) << shift 1898 if b < 0x80 { 1899 break 1900 } 1901 } 1902 fieldNum := int32(wire >> 3) 1903 wireType := int(wire & 0x7) 1904 if wireType == 4 { 1905 return fmt.Errorf("proto: IssueNodeCertificateResponse: wiretype end group for non-group") 1906 } 1907 if fieldNum <= 0 { 1908 return fmt.Errorf("proto: IssueNodeCertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) 1909 } 1910 switch fieldNum { 1911 case 1: 1912 if wireType != 2 { 1913 return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) 1914 } 1915 var stringLen uint64 1916 for shift := uint(0); ; shift += 7 { 1917 if shift >= 64 { 1918 return ErrIntOverflowCa 1919 } 1920 if iNdEx >= l { 1921 return io.ErrUnexpectedEOF 1922 } 1923 b := dAtA[iNdEx] 1924 iNdEx++ 1925 stringLen |= uint64(b&0x7F) << shift 1926 if b < 0x80 { 1927 break 1928 } 1929 } 1930 intStringLen := int(stringLen) 1931 if intStringLen < 0 { 1932 return ErrInvalidLengthCa 1933 } 1934 postIndex := iNdEx + intStringLen 1935 if postIndex < 0 { 1936 return ErrInvalidLengthCa 1937 } 1938 if postIndex > l { 1939 return io.ErrUnexpectedEOF 1940 } 1941 m.NodeID = string(dAtA[iNdEx:postIndex]) 1942 iNdEx = postIndex 1943 case 2: 1944 if wireType != 0 { 1945 return fmt.Errorf("proto: wrong wireType = %d for field NodeMembership", wireType) 1946 } 1947 m.NodeMembership = 0 1948 for shift := uint(0); ; shift += 7 { 1949 if shift >= 64 { 1950 return ErrIntOverflowCa 1951 } 1952 if iNdEx >= l { 1953 return io.ErrUnexpectedEOF 1954 } 1955 b := dAtA[iNdEx] 1956 iNdEx++ 1957 m.NodeMembership |= NodeSpec_Membership(b&0x7F) << shift 1958 if b < 0x80 { 1959 break 1960 } 1961 } 1962 default: 1963 iNdEx = preIndex 1964 skippy, err := skipCa(dAtA[iNdEx:]) 1965 if err != nil { 1966 return err 1967 } 1968 if skippy < 0 { 1969 return ErrInvalidLengthCa 1970 } 1971 if (iNdEx + skippy) < 0 { 1972 return ErrInvalidLengthCa 1973 } 1974 if (iNdEx + skippy) > l { 1975 return io.ErrUnexpectedEOF 1976 } 1977 iNdEx += skippy 1978 } 1979 } 1980 1981 if iNdEx > l { 1982 return io.ErrUnexpectedEOF 1983 } 1984 return nil 1985 } 1986 func (m *GetRootCACertificateRequest) Unmarshal(dAtA []byte) error { 1987 l := len(dAtA) 1988 iNdEx := 0 1989 for iNdEx < l { 1990 preIndex := iNdEx 1991 var wire uint64 1992 for shift := uint(0); ; shift += 7 { 1993 if shift >= 64 { 1994 return ErrIntOverflowCa 1995 } 1996 if iNdEx >= l { 1997 return io.ErrUnexpectedEOF 1998 } 1999 b := dAtA[iNdEx] 2000 iNdEx++ 2001 wire |= uint64(b&0x7F) << shift 2002 if b < 0x80 { 2003 break 2004 } 2005 } 2006 fieldNum := int32(wire >> 3) 2007 wireType := int(wire & 0x7) 2008 if wireType == 4 { 2009 return fmt.Errorf("proto: GetRootCACertificateRequest: wiretype end group for non-group") 2010 } 2011 if fieldNum <= 0 { 2012 return fmt.Errorf("proto: GetRootCACertificateRequest: illegal tag %d (wire type %d)", fieldNum, wire) 2013 } 2014 switch fieldNum { 2015 default: 2016 iNdEx = preIndex 2017 skippy, err := skipCa(dAtA[iNdEx:]) 2018 if err != nil { 2019 return err 2020 } 2021 if skippy < 0 { 2022 return ErrInvalidLengthCa 2023 } 2024 if (iNdEx + skippy) < 0 { 2025 return ErrInvalidLengthCa 2026 } 2027 if (iNdEx + skippy) > l { 2028 return io.ErrUnexpectedEOF 2029 } 2030 iNdEx += skippy 2031 } 2032 } 2033 2034 if iNdEx > l { 2035 return io.ErrUnexpectedEOF 2036 } 2037 return nil 2038 } 2039 func (m *GetRootCACertificateResponse) Unmarshal(dAtA []byte) error { 2040 l := len(dAtA) 2041 iNdEx := 0 2042 for iNdEx < l { 2043 preIndex := iNdEx 2044 var wire uint64 2045 for shift := uint(0); ; shift += 7 { 2046 if shift >= 64 { 2047 return ErrIntOverflowCa 2048 } 2049 if iNdEx >= l { 2050 return io.ErrUnexpectedEOF 2051 } 2052 b := dAtA[iNdEx] 2053 iNdEx++ 2054 wire |= uint64(b&0x7F) << shift 2055 if b < 0x80 { 2056 break 2057 } 2058 } 2059 fieldNum := int32(wire >> 3) 2060 wireType := int(wire & 0x7) 2061 if wireType == 4 { 2062 return fmt.Errorf("proto: GetRootCACertificateResponse: wiretype end group for non-group") 2063 } 2064 if fieldNum <= 0 { 2065 return fmt.Errorf("proto: GetRootCACertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) 2066 } 2067 switch fieldNum { 2068 case 1: 2069 if wireType != 2 { 2070 return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) 2071 } 2072 var byteLen int 2073 for shift := uint(0); ; shift += 7 { 2074 if shift >= 64 { 2075 return ErrIntOverflowCa 2076 } 2077 if iNdEx >= l { 2078 return io.ErrUnexpectedEOF 2079 } 2080 b := dAtA[iNdEx] 2081 iNdEx++ 2082 byteLen |= int(b&0x7F) << shift 2083 if b < 0x80 { 2084 break 2085 } 2086 } 2087 if byteLen < 0 { 2088 return ErrInvalidLengthCa 2089 } 2090 postIndex := iNdEx + byteLen 2091 if postIndex < 0 { 2092 return ErrInvalidLengthCa 2093 } 2094 if postIndex > l { 2095 return io.ErrUnexpectedEOF 2096 } 2097 m.Certificate = append(m.Certificate[:0], dAtA[iNdEx:postIndex]...) 2098 if m.Certificate == nil { 2099 m.Certificate = []byte{} 2100 } 2101 iNdEx = postIndex 2102 default: 2103 iNdEx = preIndex 2104 skippy, err := skipCa(dAtA[iNdEx:]) 2105 if err != nil { 2106 return err 2107 } 2108 if skippy < 0 { 2109 return ErrInvalidLengthCa 2110 } 2111 if (iNdEx + skippy) < 0 { 2112 return ErrInvalidLengthCa 2113 } 2114 if (iNdEx + skippy) > l { 2115 return io.ErrUnexpectedEOF 2116 } 2117 iNdEx += skippy 2118 } 2119 } 2120 2121 if iNdEx > l { 2122 return io.ErrUnexpectedEOF 2123 } 2124 return nil 2125 } 2126 func (m *GetUnlockKeyRequest) Unmarshal(dAtA []byte) error { 2127 l := len(dAtA) 2128 iNdEx := 0 2129 for iNdEx < l { 2130 preIndex := iNdEx 2131 var wire uint64 2132 for shift := uint(0); ; shift += 7 { 2133 if shift >= 64 { 2134 return ErrIntOverflowCa 2135 } 2136 if iNdEx >= l { 2137 return io.ErrUnexpectedEOF 2138 } 2139 b := dAtA[iNdEx] 2140 iNdEx++ 2141 wire |= uint64(b&0x7F) << shift 2142 if b < 0x80 { 2143 break 2144 } 2145 } 2146 fieldNum := int32(wire >> 3) 2147 wireType := int(wire & 0x7) 2148 if wireType == 4 { 2149 return fmt.Errorf("proto: GetUnlockKeyRequest: wiretype end group for non-group") 2150 } 2151 if fieldNum <= 0 { 2152 return fmt.Errorf("proto: GetUnlockKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) 2153 } 2154 switch fieldNum { 2155 default: 2156 iNdEx = preIndex 2157 skippy, err := skipCa(dAtA[iNdEx:]) 2158 if err != nil { 2159 return err 2160 } 2161 if skippy < 0 { 2162 return ErrInvalidLengthCa 2163 } 2164 if (iNdEx + skippy) < 0 { 2165 return ErrInvalidLengthCa 2166 } 2167 if (iNdEx + skippy) > l { 2168 return io.ErrUnexpectedEOF 2169 } 2170 iNdEx += skippy 2171 } 2172 } 2173 2174 if iNdEx > l { 2175 return io.ErrUnexpectedEOF 2176 } 2177 return nil 2178 } 2179 func (m *GetUnlockKeyResponse) Unmarshal(dAtA []byte) error { 2180 l := len(dAtA) 2181 iNdEx := 0 2182 for iNdEx < l { 2183 preIndex := iNdEx 2184 var wire uint64 2185 for shift := uint(0); ; shift += 7 { 2186 if shift >= 64 { 2187 return ErrIntOverflowCa 2188 } 2189 if iNdEx >= l { 2190 return io.ErrUnexpectedEOF 2191 } 2192 b := dAtA[iNdEx] 2193 iNdEx++ 2194 wire |= uint64(b&0x7F) << shift 2195 if b < 0x80 { 2196 break 2197 } 2198 } 2199 fieldNum := int32(wire >> 3) 2200 wireType := int(wire & 0x7) 2201 if wireType == 4 { 2202 return fmt.Errorf("proto: GetUnlockKeyResponse: wiretype end group for non-group") 2203 } 2204 if fieldNum <= 0 { 2205 return fmt.Errorf("proto: GetUnlockKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) 2206 } 2207 switch fieldNum { 2208 case 1: 2209 if wireType != 2 { 2210 return fmt.Errorf("proto: wrong wireType = %d for field UnlockKey", wireType) 2211 } 2212 var byteLen int 2213 for shift := uint(0); ; shift += 7 { 2214 if shift >= 64 { 2215 return ErrIntOverflowCa 2216 } 2217 if iNdEx >= l { 2218 return io.ErrUnexpectedEOF 2219 } 2220 b := dAtA[iNdEx] 2221 iNdEx++ 2222 byteLen |= int(b&0x7F) << shift 2223 if b < 0x80 { 2224 break 2225 } 2226 } 2227 if byteLen < 0 { 2228 return ErrInvalidLengthCa 2229 } 2230 postIndex := iNdEx + byteLen 2231 if postIndex < 0 { 2232 return ErrInvalidLengthCa 2233 } 2234 if postIndex > l { 2235 return io.ErrUnexpectedEOF 2236 } 2237 m.UnlockKey = append(m.UnlockKey[:0], dAtA[iNdEx:postIndex]...) 2238 if m.UnlockKey == nil { 2239 m.UnlockKey = []byte{} 2240 } 2241 iNdEx = postIndex 2242 case 2: 2243 if wireType != 2 { 2244 return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) 2245 } 2246 var msglen int 2247 for shift := uint(0); ; shift += 7 { 2248 if shift >= 64 { 2249 return ErrIntOverflowCa 2250 } 2251 if iNdEx >= l { 2252 return io.ErrUnexpectedEOF 2253 } 2254 b := dAtA[iNdEx] 2255 iNdEx++ 2256 msglen |= int(b&0x7F) << shift 2257 if b < 0x80 { 2258 break 2259 } 2260 } 2261 if msglen < 0 { 2262 return ErrInvalidLengthCa 2263 } 2264 postIndex := iNdEx + msglen 2265 if postIndex < 0 { 2266 return ErrInvalidLengthCa 2267 } 2268 if postIndex > l { 2269 return io.ErrUnexpectedEOF 2270 } 2271 if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 2272 return err 2273 } 2274 iNdEx = postIndex 2275 default: 2276 iNdEx = preIndex 2277 skippy, err := skipCa(dAtA[iNdEx:]) 2278 if err != nil { 2279 return err 2280 } 2281 if skippy < 0 { 2282 return ErrInvalidLengthCa 2283 } 2284 if (iNdEx + skippy) < 0 { 2285 return ErrInvalidLengthCa 2286 } 2287 if (iNdEx + skippy) > l { 2288 return io.ErrUnexpectedEOF 2289 } 2290 iNdEx += skippy 2291 } 2292 } 2293 2294 if iNdEx > l { 2295 return io.ErrUnexpectedEOF 2296 } 2297 return nil 2298 } 2299 func skipCa(dAtA []byte) (n int, err error) { 2300 l := len(dAtA) 2301 iNdEx := 0 2302 for iNdEx < l { 2303 var wire uint64 2304 for shift := uint(0); ; shift += 7 { 2305 if shift >= 64 { 2306 return 0, ErrIntOverflowCa 2307 } 2308 if iNdEx >= l { 2309 return 0, io.ErrUnexpectedEOF 2310 } 2311 b := dAtA[iNdEx] 2312 iNdEx++ 2313 wire |= (uint64(b) & 0x7F) << shift 2314 if b < 0x80 { 2315 break 2316 } 2317 } 2318 wireType := int(wire & 0x7) 2319 switch wireType { 2320 case 0: 2321 for shift := uint(0); ; shift += 7 { 2322 if shift >= 64 { 2323 return 0, ErrIntOverflowCa 2324 } 2325 if iNdEx >= l { 2326 return 0, io.ErrUnexpectedEOF 2327 } 2328 iNdEx++ 2329 if dAtA[iNdEx-1] < 0x80 { 2330 break 2331 } 2332 } 2333 return iNdEx, nil 2334 case 1: 2335 iNdEx += 8 2336 return iNdEx, nil 2337 case 2: 2338 var length int 2339 for shift := uint(0); ; shift += 7 { 2340 if shift >= 64 { 2341 return 0, ErrIntOverflowCa 2342 } 2343 if iNdEx >= l { 2344 return 0, io.ErrUnexpectedEOF 2345 } 2346 b := dAtA[iNdEx] 2347 iNdEx++ 2348 length |= (int(b) & 0x7F) << shift 2349 if b < 0x80 { 2350 break 2351 } 2352 } 2353 if length < 0 { 2354 return 0, ErrInvalidLengthCa 2355 } 2356 iNdEx += length 2357 if iNdEx < 0 { 2358 return 0, ErrInvalidLengthCa 2359 } 2360 return iNdEx, nil 2361 case 3: 2362 for { 2363 var innerWire uint64 2364 var start int = iNdEx 2365 for shift := uint(0); ; shift += 7 { 2366 if shift >= 64 { 2367 return 0, ErrIntOverflowCa 2368 } 2369 if iNdEx >= l { 2370 return 0, io.ErrUnexpectedEOF 2371 } 2372 b := dAtA[iNdEx] 2373 iNdEx++ 2374 innerWire |= (uint64(b) & 0x7F) << shift 2375 if b < 0x80 { 2376 break 2377 } 2378 } 2379 innerWireType := int(innerWire & 0x7) 2380 if innerWireType == 4 { 2381 break 2382 } 2383 next, err := skipCa(dAtA[start:]) 2384 if err != nil { 2385 return 0, err 2386 } 2387 iNdEx = start + next 2388 if iNdEx < 0 { 2389 return 0, ErrInvalidLengthCa 2390 } 2391 } 2392 return iNdEx, nil 2393 case 4: 2394 return iNdEx, nil 2395 case 5: 2396 iNdEx += 4 2397 return iNdEx, nil 2398 default: 2399 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 2400 } 2401 } 2402 panic("unreachable") 2403 } 2404 2405 var ( 2406 ErrInvalidLengthCa = fmt.Errorf("proto: negative length found during unmarshaling") 2407 ErrIntOverflowCa = fmt.Errorf("proto: integer overflow") 2408 )