This repository has been archived by the owner on Jul 15, 2019. It is now read-only.
/
tlsconfig.pb.go
1887 lines (1840 loc) · 55.6 KB
/
tlsconfig.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-gogo.
// source: tlsconfig.proto
// DO NOT EDIT!
package proto
import proto1 "github.com/maditya/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/maditya/protobuf/gogoproto"
import strconv "strconv"
import bytes "bytes"
import strings "strings"
import github_com_maditya_protobuf_proto "github.com/maditya/protobuf/proto"
import sort "sort"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto1.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type TLSVersion int32
const (
TLSVersion_UNSPECIFIED TLSVersion = 0
VERSION_SSL30 TLSVersion = 768
VERSION_TLS10 TLSVersion = 769
VERSION_TLS11 TLSVersion = 770
VERSION_TLS12 TLSVersion = 771
)
var TLSVersion_name = map[int32]string{
0: "TLSVersion_UNSPECIFIED",
768: "VERSION_SSL30",
769: "VERSION_TLS10",
770: "VERSION_TLS11",
771: "VERSION_TLS12",
}
var TLSVersion_value = map[string]int32{
"TLSVersion_UNSPECIFIED": 0,
"VERSION_SSL30": 768,
"VERSION_TLS10": 769,
"VERSION_TLS11": 770,
"VERSION_TLS12": 771,
}
func (TLSVersion) EnumDescriptor() ([]byte, []int) { return fileDescriptorTlsconfig, []int{0} }
type ClientAuthType int32
const (
NO_CLIENT_CERT ClientAuthType = 0
REQUEST_CLIENT_CERT ClientAuthType = 1
REQUIRE_ANY_CLIENT_CERT ClientAuthType = 2
VERIFY_CLIENT_CERT_IF_GIVEN ClientAuthType = 3
REQUIRE_AND_VERIFY_CLIENT_CERT ClientAuthType = 4
)
var ClientAuthType_name = map[int32]string{
0: "NO_CLIENT_CERT",
1: "REQUEST_CLIENT_CERT",
2: "REQUIRE_ANY_CLIENT_CERT",
3: "VERIFY_CLIENT_CERT_IF_GIVEN",
4: "REQUIRE_AND_VERIFY_CLIENT_CERT",
}
var ClientAuthType_value = map[string]int32{
"NO_CLIENT_CERT": 0,
"REQUEST_CLIENT_CERT": 1,
"REQUIRE_ANY_CLIENT_CERT": 2,
"VERIFY_CLIENT_CERT_IF_GIVEN": 3,
"REQUIRE_AND_VERIFY_CLIENT_CERT": 4,
}
func (ClientAuthType) EnumDescriptor() ([]byte, []int) { return fileDescriptorTlsconfig, []int{1} }
type CipherSuite int32
const (
CipherSuite_UNSPECIFIED CipherSuite = 0
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 CipherSuite = 49199
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 CipherSuite = 49200
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 CipherSuite = 49191
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA CipherSuite = 49171
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA CipherSuite = 49172
TLS_RSA_WITH_AES_128_GCM_SHA256 CipherSuite = 156
TLS_RSA_WITH_AES_256_GCM_SHA384 CipherSuite = 157
TLS_RSA_WITH_AES_128_CBC_SHA256 CipherSuite = 60
TLS_RSA_WITH_AES_128_CBC_SHA CipherSuite = 47
TLS_RSA_WITH_AES_256_CBC_SHA CipherSuite = 53
TLS_RSA_WITH_RC4_128_SHA CipherSuite = 5
TLS_RSA_WITH_3DES_EDE_CBC_SHA CipherSuite = 10
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA CipherSuite = 49159
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA CipherSuite = 49161
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA CipherSuite = 49162
TLS_ECDHE_RSA_WITH_RC4_128_SHA CipherSuite = 49169
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA CipherSuite = 49170
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 CipherSuite = 49195
TLS_FALLBACK_SCSV CipherSuite = 22016
)
var CipherSuite_name = map[int32]string{
0: "CipherSuite_UNSPECIFIED",
49199: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
49200: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
49191: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
49171: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
49172: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
156: "TLS_RSA_WITH_AES_128_GCM_SHA256",
157: "TLS_RSA_WITH_AES_256_GCM_SHA384",
60: "TLS_RSA_WITH_AES_128_CBC_SHA256",
47: "TLS_RSA_WITH_AES_128_CBC_SHA",
53: "TLS_RSA_WITH_AES_256_CBC_SHA",
5: "TLS_RSA_WITH_RC4_128_SHA",
10: "TLS_RSA_WITH_3DES_EDE_CBC_SHA",
49159: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
49161: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
49162: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
49169: "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
49170: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
49195: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
22016: "TLS_FALLBACK_SCSV",
}
var CipherSuite_value = map[string]int32{
"CipherSuite_UNSPECIFIED": 0,
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": 49199,
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": 49200,
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256": 49191,
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": 49171,
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": 49172,
"TLS_RSA_WITH_AES_128_GCM_SHA256": 156,
"TLS_RSA_WITH_AES_256_GCM_SHA384": 157,
"TLS_RSA_WITH_AES_128_CBC_SHA256": 60,
"TLS_RSA_WITH_AES_128_CBC_SHA": 47,
"TLS_RSA_WITH_AES_256_CBC_SHA": 53,
"TLS_RSA_WITH_RC4_128_SHA": 5,
"TLS_RSA_WITH_3DES_EDE_CBC_SHA": 10,
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": 49159,
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": 49161,
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": 49162,
"TLS_ECDHE_RSA_WITH_RC4_128_SHA": 49169,
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": 49170,
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": 49195,
"TLS_FALLBACK_SCSV": 22016,
}
func (CipherSuite) EnumDescriptor() ([]byte, []int) { return fileDescriptorTlsconfig, []int{2} }
type CurveID int32
const (
CurveID_UNSPECIFIED CurveID = 0
P256 CurveID = 23
P384 CurveID = 24
P521 CurveID = 25
)
var CurveID_name = map[int32]string{
0: "CurveID_UNSPECIFIED",
23: "P256",
24: "P384",
25: "P521",
}
var CurveID_value = map[string]int32{
"CurveID_UNSPECIFIED": 0,
"P256": 23,
"P384": 24,
"P521": 25,
}
func (CurveID) EnumDescriptor() ([]byte, []int) { return fileDescriptorTlsconfig, []int{3} }
// TLSConfig structure is used to configure a TLS client or server.
type TLSConfig struct {
// Certificates contains one or more certificate chains
// to present to the other side of the connection.
// Server configurations must include at least one certificate.
Certificates []*CertificateAndKeyID `protobuf:"bytes,1,rep,name=certificates" json:"certificates,omitempty"`
// RootCAs defines the set of root certificate authorities
// that clients use when verifying server certificates.
// If RootCAs is nil, TLS uses the host's root CA set.
// The certificates are expected in DER format.
RootCAs [][]byte `protobuf:"bytes,3,rep,name=root_cas,json=rootCas" json:"root_cas,omitempty"`
// NextProtos is a list of supported, application level protocols.
NextProtos []string `protobuf:"bytes,4,rep,name=next_protos,json=nextProtos" json:"next_protos,omitempty"`
// ServerName is used to verify the hostname on the returned
// certificates. It is also included in the client's handshake to support
// virtual hosting.
ServerName string `protobuf:"bytes,5,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"`
// ClientAuth determines the server's policy for
// TLS Client Authentication. The default is NoClientCert.
ClientAuth ClientAuthType `protobuf:"varint,6,opt,name=client_auth,json=clientAuth,proto3,enum=proto.ClientAuthType" json:"client_auth,omitempty"`
// ClientCAs defines the set of root certificate authorities that servers
// use if required to verify a client certificate by the policy in
// ClientAuth. The certificates are expected in DER format.
ClientCAs [][]byte `protobuf:"bytes,7,rep,name=client_cas,json=clientCas" json:"client_cas,omitempty"`
// CipherSuites is a list of supported cipher suites. If CipherSuites
// is nil, TLS uses a list of suites supported by the implementation.
CipherSuites []CipherSuite `protobuf:"varint,8,rep,packed,name=cipher_suites,json=cipherSuites,enum=proto.CipherSuite" json:"cipher_suites,omitempty"`
// PreferServerCipherSuites controls whether the server selects the
// client's most preferred ciphersuite, or the server's most preferred
// ciphersuite. If true then the server's preference, as expressed in
// the order of elements in CipherSuites, is used.
PreferServerCipherSuites bool `protobuf:"varint,9,opt,name=prefer_server_cipher_suites,json=preferServerCipherSuites,proto3" json:"prefer_server_cipher_suites,omitempty"`
// SessionTicketsEnabled may be set to true to enable session ticket
// (resumption) support. Enabling session tickets limits forward secrecy to
// until after the lifetime of the session ticket key (which, by default,
// lives as long as the server process).
SessionTicketsEnabled bool `protobuf:"varint,10,opt,name=session_tickets_enabled,json=sessionTicketsEnabled,proto3" json:"session_tickets_enabled,omitempty"`
// SessionTicketKey (32 bytes) is used by TLS servers to provide session
// resumption. See RFC 5077. If zero, it will be filled with random data
// before the first server handshake.
//
// If multiple servers are terminating connections for the same host
// they should all have the same SessionTicketKey. If the
// SessionTicketKey leaks, previously recorded and future TLS
// connections using that key are compromised.
SessionTicketKeyID string `protobuf:"bytes,11,opt,name=session_ticket_key_id,json=sessionTicketKeyId,proto3" json:"session_ticket_key_id,omitempty"`
// MinVersion contains the minimum SSL/TLS version that is acceptable.
// If zero, then SSLv3 is taken as the minimum.
MinVersion TLSVersion `protobuf:"varint,12,opt,name=min_version,json=minVersion,proto3,enum=proto.TLSVersion" json:"min_version,omitempty"`
// MaxVersion contains the maximum SSL/TLS version that is acceptable.
// If zero, then the maximum version supported by this package is used,
// which is currently TLS 1.2.
MaxVersion TLSVersion `protobuf:"varint,13,opt,name=max_version,json=maxVersion,proto3,enum=proto.TLSVersion" json:"max_version,omitempty"`
// CurvePreferences contains the elliptic curves that will be used in
// an ECDHE handshake, in preference order. If empty, the default will
// be used.
CurvePreferences []CurveID `protobuf:"varint,14,rep,packed,name=curve_preferences,json=curvePreferences,enum=proto.CurveID" json:"curve_preferences,omitempty"`
}
func (m *TLSConfig) Reset() { *m = TLSConfig{} }
func (*TLSConfig) ProtoMessage() {}
func (*TLSConfig) Descriptor() ([]byte, []int) { return fileDescriptorTlsconfig, []int{0} }
func (m *TLSConfig) GetCertificates() []*CertificateAndKeyID {
if m != nil {
return m.Certificates
}
return nil
}
type CertificateAndKeyID struct {
// Certificate contains the public certificates in DER format, leaf first.
Certificate [][]byte `protobuf:"bytes,1,rep,name=certificate" json:"certificate,omitempty"`
KeyID string `protobuf:"bytes,2,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
OCSPStaple []byte `protobuf:"bytes,3,opt,name=OCSP_staple,json=OCSPStaple,proto3" json:"OCSP_staple,omitempty"`
}
func (m *CertificateAndKeyID) Reset() { *m = CertificateAndKeyID{} }
func (*CertificateAndKeyID) ProtoMessage() {}
func (*CertificateAndKeyID) Descriptor() ([]byte, []int) { return fileDescriptorTlsconfig, []int{1} }
func init() {
proto1.RegisterType((*TLSConfig)(nil), "proto.TLSConfig")
proto1.RegisterType((*CertificateAndKeyID)(nil), "proto.CertificateAndKeyID")
proto1.RegisterEnum("proto.TLSVersion", TLSVersion_name, TLSVersion_value)
proto1.RegisterEnum("proto.ClientAuthType", ClientAuthType_name, ClientAuthType_value)
proto1.RegisterEnum("proto.CipherSuite", CipherSuite_name, CipherSuite_value)
proto1.RegisterEnum("proto.CurveID", CurveID_name, CurveID_value)
}
func (x TLSVersion) String() string {
s, ok := TLSVersion_name[int32(x)]
if ok {
return s
}
return strconv.Itoa(int(x))
}
func (x ClientAuthType) String() string {
s, ok := ClientAuthType_name[int32(x)]
if ok {
return s
}
return strconv.Itoa(int(x))
}
func (x CipherSuite) String() string {
s, ok := CipherSuite_name[int32(x)]
if ok {
return s
}
return strconv.Itoa(int(x))
}
func (x CurveID) String() string {
s, ok := CurveID_name[int32(x)]
if ok {
return s
}
return strconv.Itoa(int(x))
}
func (this *TLSConfig) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*TLSConfig)
if !ok {
that2, ok := that.(TLSConfig)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *TLSConfig")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *TLSConfig but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *TLSConfig but is not nil && this == nil")
}
if len(this.Certificates) != len(that1.Certificates) {
return fmt.Errorf("Certificates this(%v) Not Equal that(%v)", len(this.Certificates), len(that1.Certificates))
}
for i := range this.Certificates {
if !this.Certificates[i].Equal(that1.Certificates[i]) {
return fmt.Errorf("Certificates this[%v](%v) Not Equal that[%v](%v)", i, this.Certificates[i], i, that1.Certificates[i])
}
}
if len(this.RootCAs) != len(that1.RootCAs) {
return fmt.Errorf("RootCAs this(%v) Not Equal that(%v)", len(this.RootCAs), len(that1.RootCAs))
}
for i := range this.RootCAs {
if !bytes.Equal(this.RootCAs[i], that1.RootCAs[i]) {
return fmt.Errorf("RootCAs this[%v](%v) Not Equal that[%v](%v)", i, this.RootCAs[i], i, that1.RootCAs[i])
}
}
if len(this.NextProtos) != len(that1.NextProtos) {
return fmt.Errorf("NextProtos this(%v) Not Equal that(%v)", len(this.NextProtos), len(that1.NextProtos))
}
for i := range this.NextProtos {
if this.NextProtos[i] != that1.NextProtos[i] {
return fmt.Errorf("NextProtos this[%v](%v) Not Equal that[%v](%v)", i, this.NextProtos[i], i, that1.NextProtos[i])
}
}
if this.ServerName != that1.ServerName {
return fmt.Errorf("ServerName this(%v) Not Equal that(%v)", this.ServerName, that1.ServerName)
}
if this.ClientAuth != that1.ClientAuth {
return fmt.Errorf("ClientAuth this(%v) Not Equal that(%v)", this.ClientAuth, that1.ClientAuth)
}
if len(this.ClientCAs) != len(that1.ClientCAs) {
return fmt.Errorf("ClientCAs this(%v) Not Equal that(%v)", len(this.ClientCAs), len(that1.ClientCAs))
}
for i := range this.ClientCAs {
if !bytes.Equal(this.ClientCAs[i], that1.ClientCAs[i]) {
return fmt.Errorf("ClientCAs this[%v](%v) Not Equal that[%v](%v)", i, this.ClientCAs[i], i, that1.ClientCAs[i])
}
}
if len(this.CipherSuites) != len(that1.CipherSuites) {
return fmt.Errorf("CipherSuites this(%v) Not Equal that(%v)", len(this.CipherSuites), len(that1.CipherSuites))
}
for i := range this.CipherSuites {
if this.CipherSuites[i] != that1.CipherSuites[i] {
return fmt.Errorf("CipherSuites this[%v](%v) Not Equal that[%v](%v)", i, this.CipherSuites[i], i, that1.CipherSuites[i])
}
}
if this.PreferServerCipherSuites != that1.PreferServerCipherSuites {
return fmt.Errorf("PreferServerCipherSuites this(%v) Not Equal that(%v)", this.PreferServerCipherSuites, that1.PreferServerCipherSuites)
}
if this.SessionTicketsEnabled != that1.SessionTicketsEnabled {
return fmt.Errorf("SessionTicketsEnabled this(%v) Not Equal that(%v)", this.SessionTicketsEnabled, that1.SessionTicketsEnabled)
}
if this.SessionTicketKeyID != that1.SessionTicketKeyID {
return fmt.Errorf("SessionTicketKeyID this(%v) Not Equal that(%v)", this.SessionTicketKeyID, that1.SessionTicketKeyID)
}
if this.MinVersion != that1.MinVersion {
return fmt.Errorf("MinVersion this(%v) Not Equal that(%v)", this.MinVersion, that1.MinVersion)
}
if this.MaxVersion != that1.MaxVersion {
return fmt.Errorf("MaxVersion this(%v) Not Equal that(%v)", this.MaxVersion, that1.MaxVersion)
}
if len(this.CurvePreferences) != len(that1.CurvePreferences) {
return fmt.Errorf("CurvePreferences this(%v) Not Equal that(%v)", len(this.CurvePreferences), len(that1.CurvePreferences))
}
for i := range this.CurvePreferences {
if this.CurvePreferences[i] != that1.CurvePreferences[i] {
return fmt.Errorf("CurvePreferences this[%v](%v) Not Equal that[%v](%v)", i, this.CurvePreferences[i], i, that1.CurvePreferences[i])
}
}
return nil
}
func (this *TLSConfig) Equal(that interface{}) bool {
if that == nil {
if this == nil {
return true
}
return false
}
that1, ok := that.(*TLSConfig)
if !ok {
that2, ok := that.(TLSConfig)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} else if this == nil {
return false
}
if len(this.Certificates) != len(that1.Certificates) {
return false
}
for i := range this.Certificates {
if !this.Certificates[i].Equal(that1.Certificates[i]) {
return false
}
}
if len(this.RootCAs) != len(that1.RootCAs) {
return false
}
for i := range this.RootCAs {
if !bytes.Equal(this.RootCAs[i], that1.RootCAs[i]) {
return false
}
}
if len(this.NextProtos) != len(that1.NextProtos) {
return false
}
for i := range this.NextProtos {
if this.NextProtos[i] != that1.NextProtos[i] {
return false
}
}
if this.ServerName != that1.ServerName {
return false
}
if this.ClientAuth != that1.ClientAuth {
return false
}
if len(this.ClientCAs) != len(that1.ClientCAs) {
return false
}
for i := range this.ClientCAs {
if !bytes.Equal(this.ClientCAs[i], that1.ClientCAs[i]) {
return false
}
}
if len(this.CipherSuites) != len(that1.CipherSuites) {
return false
}
for i := range this.CipherSuites {
if this.CipherSuites[i] != that1.CipherSuites[i] {
return false
}
}
if this.PreferServerCipherSuites != that1.PreferServerCipherSuites {
return false
}
if this.SessionTicketsEnabled != that1.SessionTicketsEnabled {
return false
}
if this.SessionTicketKeyID != that1.SessionTicketKeyID {
return false
}
if this.MinVersion != that1.MinVersion {
return false
}
if this.MaxVersion != that1.MaxVersion {
return false
}
if len(this.CurvePreferences) != len(that1.CurvePreferences) {
return false
}
for i := range this.CurvePreferences {
if this.CurvePreferences[i] != that1.CurvePreferences[i] {
return false
}
}
return true
}
func (this *CertificateAndKeyID) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*CertificateAndKeyID)
if !ok {
that2, ok := that.(CertificateAndKeyID)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *CertificateAndKeyID")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *CertificateAndKeyID but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *CertificateAndKeyID but is not nil && this == nil")
}
if len(this.Certificate) != len(that1.Certificate) {
return fmt.Errorf("Certificate this(%v) Not Equal that(%v)", len(this.Certificate), len(that1.Certificate))
}
for i := range this.Certificate {
if !bytes.Equal(this.Certificate[i], that1.Certificate[i]) {
return fmt.Errorf("Certificate this[%v](%v) Not Equal that[%v](%v)", i, this.Certificate[i], i, that1.Certificate[i])
}
}
if this.KeyID != that1.KeyID {
return fmt.Errorf("KeyID this(%v) Not Equal that(%v)", this.KeyID, that1.KeyID)
}
if !bytes.Equal(this.OCSPStaple, that1.OCSPStaple) {
return fmt.Errorf("OCSPStaple this(%v) Not Equal that(%v)", this.OCSPStaple, that1.OCSPStaple)
}
return nil
}
func (this *CertificateAndKeyID) Equal(that interface{}) bool {
if that == nil {
if this == nil {
return true
}
return false
}
that1, ok := that.(*CertificateAndKeyID)
if !ok {
that2, ok := that.(CertificateAndKeyID)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} else if this == nil {
return false
}
if len(this.Certificate) != len(that1.Certificate) {
return false
}
for i := range this.Certificate {
if !bytes.Equal(this.Certificate[i], that1.Certificate[i]) {
return false
}
}
if this.KeyID != that1.KeyID {
return false
}
if !bytes.Equal(this.OCSPStaple, that1.OCSPStaple) {
return false
}
return true
}
func (this *TLSConfig) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 17)
s = append(s, "&proto.TLSConfig{")
if this.Certificates != nil {
s = append(s, "Certificates: "+fmt.Sprintf("%#v", this.Certificates)+",\n")
}
s = append(s, "RootCAs: "+fmt.Sprintf("%#v", this.RootCAs)+",\n")
s = append(s, "NextProtos: "+fmt.Sprintf("%#v", this.NextProtos)+",\n")
s = append(s, "ServerName: "+fmt.Sprintf("%#v", this.ServerName)+",\n")
s = append(s, "ClientAuth: "+fmt.Sprintf("%#v", this.ClientAuth)+",\n")
s = append(s, "ClientCAs: "+fmt.Sprintf("%#v", this.ClientCAs)+",\n")
s = append(s, "CipherSuites: "+fmt.Sprintf("%#v", this.CipherSuites)+",\n")
s = append(s, "PreferServerCipherSuites: "+fmt.Sprintf("%#v", this.PreferServerCipherSuites)+",\n")
s = append(s, "SessionTicketsEnabled: "+fmt.Sprintf("%#v", this.SessionTicketsEnabled)+",\n")
s = append(s, "SessionTicketKeyID: "+fmt.Sprintf("%#v", this.SessionTicketKeyID)+",\n")
s = append(s, "MinVersion: "+fmt.Sprintf("%#v", this.MinVersion)+",\n")
s = append(s, "MaxVersion: "+fmt.Sprintf("%#v", this.MaxVersion)+",\n")
s = append(s, "CurvePreferences: "+fmt.Sprintf("%#v", this.CurvePreferences)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func (this *CertificateAndKeyID) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 7)
s = append(s, "&proto.CertificateAndKeyID{")
s = append(s, "Certificate: "+fmt.Sprintf("%#v", this.Certificate)+",\n")
s = append(s, "KeyID: "+fmt.Sprintf("%#v", this.KeyID)+",\n")
s = append(s, "OCSPStaple: "+fmt.Sprintf("%#v", this.OCSPStaple)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringTlsconfig(v interface{}, typ string) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
}
func extensionToGoStringTlsconfig(m github_com_maditya_protobuf_proto.Message) string {
e := github_com_maditya_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *TLSConfig) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *TLSConfig) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Certificates) > 0 {
for _, msg := range m.Certificates {
data[i] = 0xa
i++
i = encodeVarintTlsconfig(data, i, uint64(msg.Size()))
n, err := msg.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.RootCAs) > 0 {
for _, b := range m.RootCAs {
data[i] = 0x1a
i++
i = encodeVarintTlsconfig(data, i, uint64(len(b)))
i += copy(data[i:], b)
}
}
if len(m.NextProtos) > 0 {
for _, s := range m.NextProtos {
data[i] = 0x22
i++
l = len(s)
for l >= 1<<7 {
data[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
data[i] = uint8(l)
i++
i += copy(data[i:], s)
}
}
if len(m.ServerName) > 0 {
data[i] = 0x2a
i++
i = encodeVarintTlsconfig(data, i, uint64(len(m.ServerName)))
i += copy(data[i:], m.ServerName)
}
if m.ClientAuth != 0 {
data[i] = 0x30
i++
i = encodeVarintTlsconfig(data, i, uint64(m.ClientAuth))
}
if len(m.ClientCAs) > 0 {
for _, b := range m.ClientCAs {
data[i] = 0x3a
i++
i = encodeVarintTlsconfig(data, i, uint64(len(b)))
i += copy(data[i:], b)
}
}
if len(m.CipherSuites) > 0 {
data2 := make([]byte, len(m.CipherSuites)*10)
var j1 int
for _, num := range m.CipherSuites {
for num >= 1<<7 {
data2[j1] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j1++
}
data2[j1] = uint8(num)
j1++
}
data[i] = 0x42
i++
i = encodeVarintTlsconfig(data, i, uint64(j1))
i += copy(data[i:], data2[:j1])
}
if m.PreferServerCipherSuites {
data[i] = 0x48
i++
if m.PreferServerCipherSuites {
data[i] = 1
} else {
data[i] = 0
}
i++
}
if m.SessionTicketsEnabled {
data[i] = 0x50
i++
if m.SessionTicketsEnabled {
data[i] = 1
} else {
data[i] = 0
}
i++
}
if len(m.SessionTicketKeyID) > 0 {
data[i] = 0x5a
i++
i = encodeVarintTlsconfig(data, i, uint64(len(m.SessionTicketKeyID)))
i += copy(data[i:], m.SessionTicketKeyID)
}
if m.MinVersion != 0 {
data[i] = 0x60
i++
i = encodeVarintTlsconfig(data, i, uint64(m.MinVersion))
}
if m.MaxVersion != 0 {
data[i] = 0x68
i++
i = encodeVarintTlsconfig(data, i, uint64(m.MaxVersion))
}
if len(m.CurvePreferences) > 0 {
data4 := make([]byte, len(m.CurvePreferences)*10)
var j3 int
for _, num := range m.CurvePreferences {
for num >= 1<<7 {
data4[j3] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j3++
}
data4[j3] = uint8(num)
j3++
}
data[i] = 0x72
i++
i = encodeVarintTlsconfig(data, i, uint64(j3))
i += copy(data[i:], data4[:j3])
}
return i, nil
}
func (m *CertificateAndKeyID) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *CertificateAndKeyID) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Certificate) > 0 {
for _, b := range m.Certificate {
data[i] = 0xa
i++
i = encodeVarintTlsconfig(data, i, uint64(len(b)))
i += copy(data[i:], b)
}
}
if len(m.KeyID) > 0 {
data[i] = 0x12
i++
i = encodeVarintTlsconfig(data, i, uint64(len(m.KeyID)))
i += copy(data[i:], m.KeyID)
}
if len(m.OCSPStaple) > 0 {
data[i] = 0x1a
i++
i = encodeVarintTlsconfig(data, i, uint64(len(m.OCSPStaple)))
i += copy(data[i:], m.OCSPStaple)
}
return i, nil
}
func encodeFixed64Tlsconfig(data []byte, offset int, v uint64) int {
data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24)
data[offset+4] = uint8(v >> 32)
data[offset+5] = uint8(v >> 40)
data[offset+6] = uint8(v >> 48)
data[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Tlsconfig(data []byte, offset int, v uint32) int {
data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintTlsconfig(data []byte, offset int, v uint64) int {
for v >= 1<<7 {
data[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
data[offset] = uint8(v)
return offset + 1
}
func NewPopulatedTLSConfig(r randyTlsconfig, easy bool) *TLSConfig {
this := &TLSConfig{}
if r.Intn(10) != 0 {
v1 := r.Intn(5)
this.Certificates = make([]*CertificateAndKeyID, v1)
for i := 0; i < v1; i++ {
this.Certificates[i] = NewPopulatedCertificateAndKeyID(r, easy)
}
}
v2 := r.Intn(10)
this.RootCAs = make([][]byte, v2)
for i := 0; i < v2; i++ {
v3 := r.Intn(100)
this.RootCAs[i] = make([]byte, v3)
for j := 0; j < v3; j++ {
this.RootCAs[i][j] = byte(r.Intn(256))
}
}
v4 := r.Intn(10)
this.NextProtos = make([]string, v4)
for i := 0; i < v4; i++ {
this.NextProtos[i] = randStringTlsconfig(r)
}
this.ServerName = randStringTlsconfig(r)
this.ClientAuth = ClientAuthType([]int32{0, 1, 2, 3, 4}[r.Intn(5)])
v5 := r.Intn(10)
this.ClientCAs = make([][]byte, v5)
for i := 0; i < v5; i++ {
v6 := r.Intn(100)
this.ClientCAs[i] = make([]byte, v6)
for j := 0; j < v6; j++ {
this.ClientCAs[i][j] = byte(r.Intn(256))
}
}
v7 := r.Intn(10)
this.CipherSuites = make([]CipherSuite, v7)
for i := 0; i < v7; i++ {
this.CipherSuites[i] = CipherSuite([]int32{0, 49199, 49200, 49191, 49171, 49172, 156, 157, 60, 47, 53, 5, 10, 49159, 49161, 49162, 49169, 49170, 49195, 22016}[r.Intn(20)])
}
this.PreferServerCipherSuites = bool(bool(r.Intn(2) == 0))
this.SessionTicketsEnabled = bool(bool(r.Intn(2) == 0))
this.SessionTicketKeyID = randStringTlsconfig(r)
this.MinVersion = TLSVersion([]int32{0, 768, 769, 770, 771}[r.Intn(5)])
this.MaxVersion = TLSVersion([]int32{0, 768, 769, 770, 771}[r.Intn(5)])
v8 := r.Intn(10)
this.CurvePreferences = make([]CurveID, v8)
for i := 0; i < v8; i++ {
this.CurvePreferences[i] = CurveID([]int32{0, 23, 24, 25}[r.Intn(4)])
}
if !easy && r.Intn(10) != 0 {
}
return this
}
func NewPopulatedCertificateAndKeyID(r randyTlsconfig, easy bool) *CertificateAndKeyID {
this := &CertificateAndKeyID{}
v9 := r.Intn(10)
this.Certificate = make([][]byte, v9)
for i := 0; i < v9; i++ {
v10 := r.Intn(100)
this.Certificate[i] = make([]byte, v10)
for j := 0; j < v10; j++ {
this.Certificate[i][j] = byte(r.Intn(256))
}
}
this.KeyID = randStringTlsconfig(r)
v11 := r.Intn(100)
this.OCSPStaple = make([]byte, v11)
for i := 0; i < v11; i++ {
this.OCSPStaple[i] = byte(r.Intn(256))
}
if !easy && r.Intn(10) != 0 {
}
return this
}
type randyTlsconfig interface {
Float32() float32
Float64() float64
Int63() int64
Int31() int32
Uint32() uint32
Intn(n int) int
}
func randUTF8RuneTlsconfig(r randyTlsconfig) rune {
ru := r.Intn(62)
if ru < 10 {
return rune(ru + 48)
} else if ru < 36 {
return rune(ru + 55)
}
return rune(ru + 61)
}
func randStringTlsconfig(r randyTlsconfig) string {
v12 := r.Intn(100)
tmps := make([]rune, v12)
for i := 0; i < v12; i++ {
tmps[i] = randUTF8RuneTlsconfig(r)
}
return string(tmps)
}
func randUnrecognizedTlsconfig(r randyTlsconfig, maxFieldNumber int) (data []byte) {
l := r.Intn(5)
for i := 0; i < l; i++ {
wire := r.Intn(4)
if wire == 3 {
wire = 5
}
fieldNumber := maxFieldNumber + r.Intn(100)
data = randFieldTlsconfig(data, r, fieldNumber, wire)
}
return data
}
func randFieldTlsconfig(data []byte, r randyTlsconfig, fieldNumber int, wire int) []byte {
key := uint32(fieldNumber)<<3 | uint32(wire)
switch wire {
case 0:
data = encodeVarintPopulateTlsconfig(data, uint64(key))
v13 := r.Int63()
if r.Intn(2) == 0 {
v13 *= -1
}
data = encodeVarintPopulateTlsconfig(data, uint64(v13))
case 1:
data = encodeVarintPopulateTlsconfig(data, uint64(key))
data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
case 2:
data = encodeVarintPopulateTlsconfig(data, uint64(key))
ll := r.Intn(100)
data = encodeVarintPopulateTlsconfig(data, uint64(ll))
for j := 0; j < ll; j++ {
data = append(data, byte(r.Intn(256)))
}
default:
data = encodeVarintPopulateTlsconfig(data, uint64(key))
data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
}
return data
}
func encodeVarintPopulateTlsconfig(data []byte, v uint64) []byte {
for v >= 1<<7 {
data = append(data, uint8(uint64(v)&0x7f|0x80))
v >>= 7
}
data = append(data, uint8(v))
return data
}
func (m *TLSConfig) Size() (n int) {
var l int
_ = l
if len(m.Certificates) > 0 {
for _, e := range m.Certificates {
l = e.Size()
n += 1 + l + sovTlsconfig(uint64(l))
}
}
if len(m.RootCAs) > 0 {
for _, b := range m.RootCAs {
l = len(b)
n += 1 + l + sovTlsconfig(uint64(l))
}
}