github.com/ttpreport/gvisor-ligolo@v0.0.0-20240123134145-a858404967ba/pkg/shim/runtimeoptions/v14/runtimeoptions_cri.go (about) 1 // Copyright 2018 The containerd Authors. 2 // Copyright 2018 The gVisor Authors. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // https://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 //go:build go1.1 17 // +build go1.1 18 19 package v14 20 21 import ( 22 "fmt" 23 "io" 24 "reflect" 25 "strings" 26 27 proto "github.com/gogo/protobuf/proto" 28 ) 29 30 // This is a compile-time assertion to ensure that this generated file 31 // is compatible with the proto package it is being compiled against. 32 // A compilation error at this line likely means your copy of the 33 // proto package needs to be updated. 34 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package 35 36 type Options struct { 37 // TypeUrl specifies the type of the content inside the config file. 38 TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` 39 // ConfigPath specifies the filesystem location of the config file 40 // used by the runtime. 41 ConfigPath string `protobuf:"bytes,2,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"` 42 } 43 44 func (m *Options) Reset() { *m = Options{} } 45 func (*Options) ProtoMessage() {} 46 func (*Options) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} } 47 48 func (m *Options) GetTypeUrl() string { 49 if m != nil { 50 return m.TypeUrl 51 } 52 return "" 53 } 54 55 func (m *Options) GetConfigPath() string { 56 if m != nil { 57 return m.ConfigPath 58 } 59 return "" 60 } 61 62 func init() { 63 proto.RegisterType((*Options)(nil), "cri.runtimeoptions.v1.Options") 64 } 65 66 func (m *Options) Marshal() (dAtA []byte, err error) { 67 size := m.Size() 68 dAtA = make([]byte, size) 69 n, err := m.MarshalTo(dAtA) 70 if err != nil { 71 return nil, err 72 } 73 return dAtA[:n], nil 74 } 75 76 func (m *Options) MarshalTo(dAtA []byte) (int, error) { 77 var i int 78 _ = i 79 var l int 80 _ = l 81 if len(m.TypeUrl) > 0 { 82 dAtA[i] = 0xa 83 i++ 84 i = encodeVarintApi(dAtA, i, uint64(len(m.TypeUrl))) 85 i += copy(dAtA[i:], m.TypeUrl) 86 } 87 if len(m.ConfigPath) > 0 { 88 dAtA[i] = 0x12 89 i++ 90 i = encodeVarintApi(dAtA, i, uint64(len(m.ConfigPath))) 91 i += copy(dAtA[i:], m.ConfigPath) 92 } 93 return i, nil 94 } 95 96 func encodeVarintApi(dAtA []byte, offset int, v uint64) int { 97 for v >= 1<<7 { 98 dAtA[offset] = uint8(v&0x7f | 0x80) 99 v >>= 7 100 offset++ 101 } 102 dAtA[offset] = uint8(v) 103 return offset + 1 104 } 105 106 func (m *Options) Size() (n int) { 107 var l int 108 _ = l 109 l = len(m.TypeUrl) 110 if l > 0 { 111 n += 1 + l + sovApi(uint64(l)) 112 } 113 l = len(m.ConfigPath) 114 if l > 0 { 115 n += 1 + l + sovApi(uint64(l)) 116 } 117 return n 118 } 119 120 func sovApi(x uint64) (n int) { 121 for { 122 n++ 123 x >>= 7 124 if x == 0 { 125 break 126 } 127 } 128 return n 129 } 130 131 func sozApi(x uint64) (n int) { 132 return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 133 } 134 135 func (this *Options) String() string { 136 if this == nil { 137 return "nil" 138 } 139 s := strings.Join([]string{`&Options{`, 140 `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, 141 `ConfigPath:` + fmt.Sprintf("%v", this.ConfigPath) + `,`, 142 `}`, 143 }, "") 144 return s 145 } 146 147 func valueToStringApi(v interface{}) string { 148 rv := reflect.ValueOf(v) 149 if rv.IsNil() { 150 return "nil" 151 } 152 pv := reflect.Indirect(rv).Interface() 153 return fmt.Sprintf("*%v", pv) 154 } 155 156 func (m *Options) Unmarshal(dAtA []byte) error { 157 l := len(dAtA) 158 iNdEx := 0 159 for iNdEx < l { 160 preIndex := iNdEx 161 var wire uint64 162 for shift := uint(0); ; shift += 7 { 163 if shift >= 64 { 164 return ErrIntOverflowApi 165 } 166 if iNdEx >= l { 167 return io.ErrUnexpectedEOF 168 } 169 b := dAtA[iNdEx] 170 iNdEx++ 171 wire |= (uint64(b) & 0x7F) << shift 172 if b < 0x80 { 173 break 174 } 175 } 176 fieldNum := int32(wire >> 3) 177 wireType := int(wire & 0x7) 178 if wireType == 4 { 179 return fmt.Errorf("proto: Options: wiretype end group for non-group") 180 } 181 if fieldNum <= 0 { 182 return fmt.Errorf("proto: Options: illegal tag %d (wire type %d)", fieldNum, wire) 183 } 184 switch fieldNum { 185 case 1: 186 if wireType != 2 { 187 return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) 188 } 189 var stringLen uint64 190 for shift := uint(0); ; shift += 7 { 191 if shift >= 64 { 192 return ErrIntOverflowApi 193 } 194 if iNdEx >= l { 195 return io.ErrUnexpectedEOF 196 } 197 b := dAtA[iNdEx] 198 iNdEx++ 199 stringLen |= (uint64(b) & 0x7F) << shift 200 if b < 0x80 { 201 break 202 } 203 } 204 intStringLen := int(stringLen) 205 if intStringLen < 0 { 206 return ErrInvalidLengthApi 207 } 208 postIndex := iNdEx + intStringLen 209 if postIndex > l { 210 return io.ErrUnexpectedEOF 211 } 212 m.TypeUrl = string(dAtA[iNdEx:postIndex]) 213 iNdEx = postIndex 214 case 2: 215 if wireType != 2 { 216 return fmt.Errorf("proto: wrong wireType = %d for field ConfigPath", wireType) 217 } 218 var stringLen uint64 219 for shift := uint(0); ; shift += 7 { 220 if shift >= 64 { 221 return ErrIntOverflowApi 222 } 223 if iNdEx >= l { 224 return io.ErrUnexpectedEOF 225 } 226 b := dAtA[iNdEx] 227 iNdEx++ 228 stringLen |= (uint64(b) & 0x7F) << shift 229 if b < 0x80 { 230 break 231 } 232 } 233 intStringLen := int(stringLen) 234 if intStringLen < 0 { 235 return ErrInvalidLengthApi 236 } 237 postIndex := iNdEx + intStringLen 238 if postIndex > l { 239 return io.ErrUnexpectedEOF 240 } 241 m.ConfigPath = string(dAtA[iNdEx:postIndex]) 242 iNdEx = postIndex 243 default: 244 iNdEx = preIndex 245 skippy, err := skipApi(dAtA[iNdEx:]) 246 if err != nil { 247 return err 248 } 249 if skippy < 0 { 250 return ErrInvalidLengthApi 251 } 252 if (iNdEx + skippy) > l { 253 return io.ErrUnexpectedEOF 254 } 255 iNdEx += skippy 256 } 257 } 258 259 if iNdEx > l { 260 return io.ErrUnexpectedEOF 261 } 262 return nil 263 } 264 265 func skipApi(dAtA []byte) (n int, err error) { 266 l := len(dAtA) 267 iNdEx := 0 268 for iNdEx < l { 269 var wire uint64 270 for shift := uint(0); ; shift += 7 { 271 if shift >= 64 { 272 return 0, ErrIntOverflowApi 273 } 274 if iNdEx >= l { 275 return 0, io.ErrUnexpectedEOF 276 } 277 b := dAtA[iNdEx] 278 iNdEx++ 279 wire |= (uint64(b) & 0x7F) << shift 280 if b < 0x80 { 281 break 282 } 283 } 284 wireType := int(wire & 0x7) 285 switch wireType { 286 case 0: 287 for shift := uint(0); ; shift += 7 { 288 if shift >= 64 { 289 return 0, ErrIntOverflowApi 290 } 291 if iNdEx >= l { 292 return 0, io.ErrUnexpectedEOF 293 } 294 iNdEx++ 295 if dAtA[iNdEx-1] < 0x80 { 296 break 297 } 298 } 299 return iNdEx, nil 300 case 1: 301 iNdEx += 8 302 return iNdEx, nil 303 case 2: 304 var length int 305 for shift := uint(0); ; shift += 7 { 306 if shift >= 64 { 307 return 0, ErrIntOverflowApi 308 } 309 if iNdEx >= l { 310 return 0, io.ErrUnexpectedEOF 311 } 312 b := dAtA[iNdEx] 313 iNdEx++ 314 length |= (int(b) & 0x7F) << shift 315 if b < 0x80 { 316 break 317 } 318 } 319 iNdEx += length 320 if length < 0 { 321 return 0, ErrInvalidLengthApi 322 } 323 return iNdEx, nil 324 case 3: 325 for { 326 var innerWire uint64 327 var start int = iNdEx 328 for shift := uint(0); ; shift += 7 { 329 if shift >= 64 { 330 return 0, ErrIntOverflowApi 331 } 332 if iNdEx >= l { 333 return 0, io.ErrUnexpectedEOF 334 } 335 b := dAtA[iNdEx] 336 iNdEx++ 337 innerWire |= (uint64(b) & 0x7F) << shift 338 if b < 0x80 { 339 break 340 } 341 } 342 innerWireType := int(innerWire & 0x7) 343 if innerWireType == 4 { 344 break 345 } 346 next, err := skipApi(dAtA[start:]) 347 if err != nil { 348 return 0, err 349 } 350 iNdEx = start + next 351 } 352 return iNdEx, nil 353 case 4: 354 return iNdEx, nil 355 case 5: 356 iNdEx += 4 357 return iNdEx, nil 358 default: 359 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 360 } 361 } 362 panic("unreachable") 363 } 364 365 var ( 366 ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") 367 ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") 368 ) 369 370 func init() { proto.RegisterFile("api.proto", fileDescriptorApi) } 371 372 var fileDescriptorApi = []byte{ 373 // 183 bytes of a gzipped FileDescriptorProto 374 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0x2c, 0xc8, 0xd4, 375 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x4d, 0x2e, 0xca, 0xd4, 0x2b, 0x2a, 0xcd, 0x2b, 0xc9, 376 0xcc, 0x4d, 0xcd, 0x2f, 0x28, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2b, 0x33, 0x94, 0xd2, 0x4d, 0xcf, 377 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0xab, 378 0x4e, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0x62, 0x8a, 0x92, 0x2b, 0x17, 0xbb, 0x3f, 379 0x44, 0xb3, 0x90, 0x24, 0x17, 0x47, 0x49, 0x65, 0x41, 0x6a, 0x7c, 0x69, 0x51, 0x8e, 0x04, 0xa3, 380 0x02, 0xa3, 0x06, 0x67, 0x10, 0x3b, 0x88, 0x1f, 0x5a, 0x94, 0x23, 0x24, 0xcf, 0xc5, 0x9d, 0x9c, 381 0x9f, 0x97, 0x96, 0x99, 0x1e, 0x5f, 0x90, 0x58, 0x92, 0x21, 0xc1, 0x04, 0x96, 0xe5, 0x82, 0x08, 382 0x05, 0x24, 0x96, 0x64, 0x38, 0xc9, 0x9c, 0x78, 0x28, 0xc7, 0x78, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 383 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 384 0xc2, 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0x5d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 385 0x00, 0xf2, 0x18, 0xbe, 0x00, 0x00, 0x00, 386 }