-
Notifications
You must be signed in to change notification settings - Fork 33
/
types.go
1608 lines (1528 loc) · 51.7 KB
/
types.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
/*
Copyright 2019 HAProxy Technologies
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:godot
package types
import (
"github.com/haproxytech/config-parser/v5/common"
"github.com/haproxytech/config-parser/v5/params"
)
//sections:program
//name:command
//test:ok:command spoa-mirror --runtime 0 --mirror-url http://test.local
//test:ok:command echo \"Hello, World!\"
//test:fail:command
type Command struct {
Args string
Comment string
}
//sections:fcgi-app
//name:set-param
//is:multiple
//no:parse
//test:ok:set-param name fmt if acl
//test:ok:set-param name fmt unless acl
//test:ok:set-param name fmt
//test:fail:set-param name
//test:fail:set-param name fmt if
//test:fail:set-param name fmt unless
type SetParam struct {
Name string
Format string
Criterion string
Value string
Comment string
}
//sections:fcgi-app
//name:option max-reqs
//no:parse
//test:ok:option max-reqs 1024
//test:fail:option max-reqs
type OptionMaxReqs struct {
Reqs int64
Comment string
}
//sections:fcgi-app
//name:pass-header
//is:multiple
//no:parse
//test:ok:pass-header x-header unless acl
//test:ok:pass-header x-header if acl
//test:ok:pass-header x-header
//test:fail:pass-header
//test:fail:pass-header x-header if
//test:fail:pass-header x-header unless
type PassHeader struct {
Name string
Criterion string
Value string
Comment string
}
//sections:fcgi-app
//name:log-stderr
//is:multiple
//no:parse
//test:ok:log-stderr 127.0.0.1:1515 len 8192 format rfc5424 sample 1,2-5:6 local2 info debug
//test:ok:log-stderr 127.0.0.1:1515 len 8192 format rfc5424 sample 1,2-5:6 local2 info
//test:ok:log-stderr 127.0.0.1:1515 local2
//test:ok:log-stderr global
//test:fail:log-stderr
//test:fail:log-stderr 127.0.0.1:1515
//test:fail:log-stderr 127.0.0.1:1515 len 8192 format rfc5424 sample 1,2-5 local2 info debug
//test:fail:log-stderr 127.0.0.1:1515 len 8192 format sample 1,2-5:6 local2 info debug
//test:fail:log-stderr 127.0.0.1:1515 len format rfc5424 sample 1,2-5:6 local2 info debug
type LogStdErr struct {
Global bool
Address string
Length int64
Format string
SampleRange string
SampleSize int64
Facility string
Level string
MinLevel string
Comment string
}
//sections:frontend,backend
//name:acl
//is:multiple
//test:ok:acl url_stats path_beg /stats
//test:ok:acl url_static path_beg -i /static /images /javascript /stylesheets
//test:ok:acl url_static path_end -i .jpg .gif .png .css .js
//test:ok:acl be_app_ok nbsrv(be_app) gt 0
//test:ok:acl be_static_ok nbsrv(be_static) gt 0
//test:ok:acl key req.hdr(X-Add-ACL-Key) -m found
//test:ok:acl add path /addacl
//test:ok:acl del path /delacl
//test:ok:acl myhost hdr(Host) -f myhost.lst
//test:ok:acl clear dst_port 80
//test:ok:acl secure dst_port 8080
//test:ok:acl login_page url_beg /login
//test:ok:acl logout url_beg /logout
//test:ok:acl uid_given url_reg /login?userid=[^&]+
//test:ok:acl cookie_set hdr_sub(cookie) SEEN=1
//test:fail:acl cookie
//test:fail:acl
type ACL struct {
Name string
Criterion string
Value string
Comment string
}
//sections:frontend
//name:bind
//is:multiple
//test:fail:bind
//test:ok:bind :80,:443
//test:ok:bind 10.0.0.1:10080,10.0.0.1:10443
//test:ok:bind /var/run/ssl-frontend.sock user root mode 600 accept-proxy
//test:ok:bind :80
//test:ok:bind :443 ssl crt /etc/haproxy/site.pem
//test:ok:bind :443 ssl crt /etc/haproxy/site.pem alpn h2,http/1.1
//test:ok:bind :::443 v4v6 ssl crt /etc/haproxy/site.pem alpn h2,http/1.1
//test:ok:bind ipv6@:80
//test:ok:bind ipv4@public_ssl:443 ssl crt /etc/haproxy/site.pem
//test:ok:bind unix@ssl-frontend.sock user root mode 600 accept-proxy
//test:ok:bind :443 accept-netscaler-cip 1234
//test:ok:bind :443 accept-proxy
//test:ok:bind :443 allow-0rtt
//test:ok:bind :443 alpn h2
//test:ok:bind :443 alpn http/1.1
//test:ok:bind :443 alpn h2,http/1.1
//test:ok:bind :443 backlog test
//test:ok:bind :443 curves ECDH_ECDSA,ECDHE_ECDSA,ECDH_RSA,ECDHE_RSA,ECDH_anon
//test:ok:bind :443 ecdhe ECDH_ECDSA,ECDHE_ECDSA,ECDH_RSA,ECDHE_RSA,ECDH_anon
//test:ok:bind :443 ca-file file.pem
//test:ok:bind :443 ca-ignore-err all
//test:ok:bind :443 ca-ignore-err 1234
//test:ok:bind :443 ca-sign-file file.test
//test:ok:bind :443 ca-sign-pass passphrase
//test:ok:bind :443 ca-verify-file file.test
//test:ok:bind :443 ciphers ECDHE+aRSA+AES256+GCM+SHA384:ECDHE+aRSA+AES128+GCM+SHA256:ECDHE+aRSA+AES256+SHA384:ECDHE+aRSA+AES128+SHA256:ECDHE+aRSA+RC4+SHA:ECDHE+aRSA+AES256+SHA:ECDHE+aRSA+AES128+SHA:AES256+GCM+SHA384:AES128+GCM+SHA256:AES128+SHA256:AES256+SHA256:DHE+aRSA+AES128+SHA:RC4+SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS
//test:ok:bind :443 ciphersuites TODO
//test:ok:bind :443 client-sigalgs value
//test:ok:bind :443 crl-file file.test
//test:ok:bind :443 crt example.pem
//test:ok:bind :443 crt-ignore-err all
//test:ok:bind :443 crt-ignore-err 404,410
//test:ok:bind :443 crt-list cert1.pem
//test:ok:bind :443 defer-accept
//test:ok:bind :443 expose-fd listeners
//test:ok:bind :443 force-sslv3
//test:ok:bind :443 force-tlsv10
//test:ok:bind :443 force-tlsv11
//test:ok:bind :443 force-tlsv12
//test:ok:bind :443 force-tlsv13
//test:ok:bind :443 generate-certificates
//test:ok:bind :443 gid users
//test:ok:bind :443 group group
//test:ok:bind :443 id 1
//test:ok:bind :443 interface eth0
//test:ok:bind :443 interface eth1
//test:ok:bind :443 interface pppoe-wan
//test:ok:bind :443 level user
//test:ok:bind :443 level opeerator
//test:ok:bind :443 level admin
//test:ok:bind :443 severity-output none
//test:ok:bind :443 severity-output number
//test:ok:bind :443 severity-output string
//test:ok:bind :443 maxconn 1024
//test:ok:bind :443 mode TODO
//test:ok:bind :443 mss 1460
//test:ok:bind :443 mss -1460
//test:ok:bind :443 name sockets
//test:ok:bind :443 namespace example
//test:ok:bind :443 nice 0
//test:ok:bind :443 nice 1024
//test:ok:bind :443 nice -1024
//test:ok:bind :443 no-alpn
//test:ok:bind :443 no-ca-names
//test:ok:bind :443 no-sslv3
//test:ok:bind :443 no-tls-tickets
//test:ok:bind :443 no-tlsv10
//test:ok:bind :443 no-tlsv11
//test:ok:bind :443 no-tlsv12
//test:ok:bind :443 no-tlsv13
//test:ok:bind :443 npn http/1.0
//test:ok:bind :443 npn http/1.1
//test:ok:bind :443 npn http/1.0,http/1.1
//test:ok:bind :443 ocsp-update off
//test:ok:bind :443 ocsp-update on
//test:ok:bind :443 prefer-client-ciphers
//test:ok:bind :443 process all
//test:ok:bind :443 process odd
//test:ok:bind :443 process even
//test:ok:bind :443 process 1-4
//test:ok:bind :443 proto h2
//test:ok:bind :443 sigalgs value
//test:ok:bind :443 ssl
//test:ok:bind :443 ssl-max-ver SSLv3
//test:ok:bind :443 ssl-max-ver TLSv1.0
//test:ok:bind :443 ssl-max-ver TLSv1.1
//test:ok:bind :443 ssl-max-ver TLSv1.2
//test:ok:bind :443 ssl-max-ver TLSv1.3
//test:ok:bind :443 ssl-min-ver SSLv3
//test:ok:bind :443 ssl-min-ver TLSv1.0
//test:ok:bind :443 ssl-min-ver TLSv1.1
//test:ok:bind :443 ssl-min-ver TLSv1.2
//test:ok:bind :443 ssl-min-ver TLSv1.3
//test:ok:bind :443 strict-sni
//test:ok:bind :443 tcp-ut 30s
//test:ok:bind :443 tfo
//test:ok:bind :443 thread all
//test:ok:bind :443 thread odd
//test:ok:bind :443 thread even
//test:ok:bind :443 thread 1
//test:ok:bind :443 thread 1-1
//test:ok:bind :443 thread 1/all
//test:ok:bind :443 thread 1/odd
//test:ok:bind :443 thread 1/even
//test:ok:bind :443 thread 1/1
//test:ok:bind :443 thread 1/1-1
//test:ok:bind :443 tls-ticket-keys /tmp/tls_ticket_keys
//test:ok:bind :443 transparent
//test:ok:bind :443 v4v6
//test:ok:bind :443 v6only
//test:ok:bind :443 uid 65534
//test:ok:bind :443 user web1
//test:ok:bind :443 verify none
//test:ok:bind :443 verify optional
//test:ok:bind :443 verify required
//test:ok:bind :443 quic-cc-algo cubic
//test:ok:bind :443 quic-cc-algo newreno
//test:fail:bind :443 quic-cc-algo something
//test:ok:bind :443 quic-force-retry
//test:ok:bind :443 quic-socket connection
//test:ok:bind :443 quic-socket listener
//test:fail:bind :443 quic-socket something
//test:ok:bind :443 nbconn 1
//test:ok:bind :443 nbconn +2
type Bind struct {
Path string // can be address:port or socket path
Params []params.BindOption
Comment string
}
//sections:log-forward
//name:dgram-bind
//is:multiple
//test:fail:dgram-bind
//test:ok:dgram-bind :80,:443
//test:ok:dgram-bind 10.0.0.1:10080,10.0.0.1:10443
//test:ok:dgram-bind :443 interface eth0
//test:ok:dgram-bind :443 interface eth1
//test:ok:dgram-bind :443 interface pppoe-wan
//test:ok:dgram-bind :443 namespace example
//test:ok:dgram-bind :443 transparent
type DgramBind struct {
Path string // can be address:port or socket path
Params []params.DgramBindOption
Comment string
}
//sections:frontend
//name:bind-process
//test:ok:bind-process all
//test:ok:bind-process odd
//test:ok:bind-process even
//test:ok:bind-process 1 2 3 4
//test:ok:bind-process 1-4
//test:fail:bind-process none
//test:fail:bind-process 1+4
//test:fail:bind-process none-none
//test:fail:bind-process 1-4 1-3
type BindProcess struct {
Process string
Comment string
}
//sections:defaults,backend
//name:balance
//test:ok:balance roundrobin
//test:ok:balance uri
//test:ok:balance uri whole
//test:ok:balance uri len 12
//test:ok:balance uri depth 8
//test:ok:balance uri depth 8 whole
//test:ok:balance uri depth 8 len 12 whole
//test:ok:balance url_param
//test:ok:balance url_param session_id
//test:ok:balance url_param check_post 10
//test:ok:balance url_param check_post 10 max_wait 20
//test:ok:balance url_param session_id check_post 10 max_wait 20
//test:ok:balance hdr(hdrName)
//test:ok:balance hdr(hdrName) use_domain_only
//test:ok:balance random
//test:ok:balance random(15)
//test:ok:balance rdp-cookie
//test:ok:balance rdp-cookie(something)
//test:ok:balance hash req.cookie(clientid)
//test:ok:balance hash req.hdr_ip(x-forwarded-for,-1),ipmask(24)
//test:ok:balance hash req.hdr_ip(x-forwarded-for ,-1),ipmask(24)
//test:fails:balance something
//test:fail:balance
//test:fail:balance uri len notInteger
//test:fail:balance uri depth notInteger
//test:fail:balance url_param check_post notInteger
//test:fail:balance hash
type Balance struct {
Algorithm string
Params params.BalanceParams
Comment string
}
//sections:defaults,backend
//name:persist
//test:ok:persist rdp-cookie
//test:ok:persist rdp-cookie(cookies)
//test:fail:persist rdp-cookie (cookie-name)
//test:fail:persist rdp-cookie cookie-name
//test:fail:persist rdp-cookie cookie-name second
//test:fail:persist rdp-cookie cookie-name second third
type Persist struct {
Type string
Params params.PersistParams
Comment string
}
//sections:defaults,backend
//name:cookie
//test:ok:cookie test
//test:ok:cookie myCookie domain dom1 indirect postonly
//test:ok:cookie myCookie domain dom1 domain dom2 indirect postonly
//test:ok:cookie myCookie indirect maxidle 10 maxlife 5 postonly
//test:ok:cookie myCookie indirect maxidle 10
//test:ok:cookie myCookie indirect maxlife 10
//test:ok:cookie myCookie domain dom1 domain dom2 httponly indirect maxidle 10 maxlife 5 nocache postonly preserve rewrite secure
//test:ok:cookie myCookie attr \"SameSite=Strict\" attr \"mykey=myvalue\" insert
//test:fail:cookie
//test:fail:cookie myCookie maxidle something
//test:fail:cookie myCookie maxlife something
//test:fail:cookie myCookie attr \"SameSite=Lax;\"
type Cookie struct {
Domain []string
Attr []string
Name string
Type string
Comment string
Maxidle int64
Maxlife int64
Dynamic bool
Httponly bool
Indirect bool
Nocache bool
Postonly bool
Preserve bool
Secure bool
}
//sections:global
//name:cpu-map
//is:multiple
//test:ok:cpu-map 1-4 0-3
//test:ok:cpu-map 1/all 0-3
//test:ok:cpu-map auto:1-4 0-3
//test:ok:cpu-map auto:1-4 0-1 2-3
//test:fail:cpu-map
type CPUMap struct {
Process string
CPUSet string
Comment string
}
//sections:defaults,backend,peers
//name:default-server
//is:multiple
//test:ok:default-server addr 127.0.0.1
//test:ok:default-server addr ::1
//test:ok:default-server agent-check
//test:ok:default-server agent-send name
//test:ok:default-server agent-inter 1000ms
//test:ok:default-server agent-addr 127.0.0.1
//test:ok:default-server agent-addr site.com
//test:ok:default-server agent-port 1
//test:ok:default-server agent-port 65535
//test:ok:default-server allow-0rtt
//test:ok:default-server alpn h2
//test:ok:default-server alpn http/1.1
//test:ok:default-server alpn h2,http/1.1
//test:ok:default-server backup
//test:ok:default-server ca-file cert.crt
//test:ok:default-server check
//test:ok:default-server check-send-proxy
//test:ok:default-server check-alpn http/1.0
//test:ok:default-server check-alpn http/1.1,http/1.0
//test:ok:default-server check-proto h2
//test:ok:default-server check-ssl
//test:ok:default-server check-via-socks4
//test:ok:default-server ciphers ECDHE-RSA-AES128-GCM-SHA256
//test:ok:default-server ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
//test:ok:default-server ciphersuites ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
//test:ok:default-server cookie value
//test:ok:default-server crl-file file.pem
//test:ok:default-server crt cert.pem
//test:ok:default-server disabled
//test:ok:default-server enabled
//test:ok:default-server error-limit 50
//test:ok:default-server fall 30
//test:ok:default-server fall 1 rise 2 inter 3s port 4444
//test:ok:default-server force-sslv3
//test:ok:default-server force-tlsv10
//test:ok:default-server force-tlsv11
//test:ok:default-server force-tlsv12
//test:ok:default-server force-tlsv13
//test:ok:default-server init-addr last,libc,none
//test:ok:default-server init-addr last,libc,none,127.0.0.1
//test:ok:default-server inter 1500ms
//test:ok:default-server inter 1000 weight 13
//test:ok:default-server fastinter 2500ms
//test:ok:default-server fastinter unknown
//test:ok:default-server downinter 3500ms
//test:ok:default-server log-proto legacy
//test:ok:default-server log-proto octet-count
//test:ok:default-server maxconn 1
//test:ok:default-server maxconn 50
//test:ok:default-server maxqueue 0
//test:ok:default-server maxqueue 1000
//test:ok:default-server max-reuse -1
//test:ok:default-server max-reuse 0
//test:ok:default-server max-reuse 1
//test:ok:default-server minconn 1
//test:ok:default-server minconn 50
//test:ok:default-server namespace test
//test:ok:default-server no-agent-check
//test:ok:default-server no-backup
//test:ok:default-server no-check
//test:ok:default-server no-check-ssl
//test:ok:default-server no-send-proxy-v2
//test:ok:default-server no-send-proxy-v2-ssl
//test:ok:default-server no-send-proxy-v2-ssl-cn
//test:ok:default-server no-ssl
//test:ok:default-server no-ssl-reuse
//test:ok:default-server no-sslv3
//test:ok:default-server no-tls-tickets
//test:ok:default-server no-tlsv10
//test:ok:default-server no-tlsv11
//test:ok:default-server no-tlsv12
//test:ok:default-server no-tlsv13
//test:ok:default-server no-verifyhost
//test:ok:default-server no-tfo
//test:ok:default-server non-stick
//test:ok:default-server npn http/1.1,http/1.0
//test:ok:default-server observe layer4
//test:ok:default-server observe layer7
//test:ok:default-server on-error fastinter
//test:ok:default-server on-error fail-check
//test:ok:default-server on-error sudden-death
//test:ok:default-server on-error mark-down
//test:ok:default-server on-marked-down shutdown-sessions
//test:ok:default-server on-marked-up shutdown-backup-session
//test:ok:default-server pool-max-conn -1
//test:ok:default-server pool-max-conn 0
//test:ok:default-server pool-max-conn 100
//test:ok:default-server pool-purge-delay 0
//test:ok:default-server pool-purge-delay 5
//test:ok:default-server pool-purge-delay 500
//test:ok:default-server port 27015
//test:ok:default-server port 27016
//test:ok:default-server proto h2
//test:ok:default-server redir http://image1.mydomain.com
//test:ok:default-server redir https://image1.mydomain.com
//test:ok:default-server rise 2
//test:ok:default-server rise 200
//test:ok:default-server resolve-opts allow-dup-ip
//test:ok:default-server resolve-opts ignore-weight
//test:ok:default-server resolve-opts allow-dup-ip,ignore-weight
//test:ok:default-server resolve-opts prevent-dup-ip,ignore-weight
//test:ok:default-server resolve-prefer ipv4
//test:ok:default-server resolve-prefer ipv6
//test:ok:default-server resolve-net 10.0.0.0/8
//test:ok:default-server resolve-net 10.0.0.0/8,10.0.0.0/16
//test:ok:default-server resolvers mydns
//test:ok:default-server send-proxy
//test:ok:default-server send-proxy-v2
//test:ok:default-server proxy-v2-options ssl
//test:ok:default-server proxy-v2-options ssl,cert-cn
//test:ok:default-server proxy-v2-options ssl,cert-cn,ssl-cipher,cert-sig,cert-key,authority,crc32c,unique-id
//test:ok:default-server send-proxy-v2-ssl
//test:ok:default-server send-proxy-v2-ssl-cn
//test:ok:default-server slowstart 2000ms
//test:ok:default-server sni TODO
//test:ok:default-server source TODO
//test:ok:default-server ssl
//test:ok:default-server ssl-max-ver SSLv3
//test:ok:default-server ssl-max-ver TLSv1.0
//test:ok:default-server ssl-max-ver TLSv1.1
//test:ok:default-server ssl-max-ver TLSv1.2
//test:ok:default-server ssl-max-ver TLSv1.3
//test:ok:default-server ssl-min-ver SSLv3
//test:ok:default-server ssl-min-ver TLSv1.0
//test:ok:default-server ssl-min-ver TLSv1.1
//test:ok:default-server ssl-min-ver TLSv1.2
//test:ok:default-server ssl-min-ver TLSv1.3
//test:ok:default-server ssl-reuse
//test:ok:default-server stick
//test:ok:default-server socks4 127.0.0.1:81
//test:ok:default-server tcp-ut 20ms
//test:ok:default-server tfo
//test:ok:default-server track TODO
//test:ok:default-server tls-tickets
//test:ok:default-server verify none
//test:ok:default-server verify required
//test:ok:default-server verifyhost site.com
//test:ok:default-server weight 1
//test:ok:default-server weight 128
//test:ok:default-server weight 256
//test:ok:default-server pool-low-conn 384
//test:ok:default-server ws h1
//test:ok:default-server ws h2
//test:ok:default-server ws auto
//test:ok:default-server log-bufsize 10
//test:fail:default-server
type DefaultServer struct {
Params []params.ServerOption
Comment string
}
//sections:defaults,backend,frontend
//name:email-alert
//is:multiple
//test:ok:email-alert from admin@example.com
//test:ok:email-alert to a@z,x@y
//test:quote_ok:email-alert to "a@b, c@d"
//test:fail:email-alert to a@b, c@d
//test:ok:email-alert level warning
//test:fail:email-alert level max
//test:ok:email-alert mailers local-mailers
//test:ok:email-alert myhostname srv01.example.com
//test:ok:email-alert to support@example.com
//test:fail:email-alert
type EmailAlert struct {
Attribute string
Value string
Comment string
}
//sections:defaults,frontend,backend
//name:errorfile
//no:init
//is:multiple
//test:ok:errorfile 400 /etc/haproxy/errorfiles/400badreq.http
//test:ok:errorfile 408 /dev/null # work around Chrome pre-connect bug
//test:ok:errorfile 403 /etc/haproxy/errorfiles/403forbid.http
//test:ok:errorfile 503 /etc/haproxy/errorfiles/503sorry.http
//test:fail:errorfile
type ErrorFile struct {
Code string
File string
Comment string
}
//sections:defaults,frontend,backend
//name:errorloc302
//test:ok:errorloc302 400 http://www.myawesomesite.com/error_page
//test:ok:errorloc302 404 http://www.myawesomesite.com/not_found
//test:ok:errorloc302 501 /error_page
//test:fail:errorloc302
//test:fail:errorloc302 500
//test:fail:errorloc302 /error_page
//test:fail:errorloc302 201 /error_page
type ErrorLoc302 struct {
Code string
URL string
Comment string
}
//sections:defaults,frontend,backend
//name:errorloc303
//test:ok:errorloc303 400 http://www.myawesomesite.com/error_page
//test:ok:errorloc303 404 http://www.myawesomesite.com/not_found
//test:ok:errorloc303 501 /error_page
//test:fail:errorloc303
//test:fail:errorloc303 500
//test:fail:errorloc303 /error_page
//test:fail:errorloc303 201 /error_page
type ErrorLoc303 struct {
Code string
URL string
Comment string
}
//sections:defaults,frontend,backend
//name:errorfiles
//no:init
//is:multiple
//test:ok:errorfiles errors_section 400
//test:ok:errorfiles errors_section 400 401 500
//test:ok:errorfiles errors_section
//test:fail:errorfiles
//test:fail:errorfiles errors_section 201
//test:fail:errorfiles errors_section test
//test:fail:errorfiles errors_section 400 201
//test:fail:errorfiles errors_section 400 test
type ErrorFiles struct {
Name string
Codes []int64
Comment string
}
//sections:userlist
//name:group
//is:multiple
//test:ok:group G1 users tiger,scott
//test:ok:group G1
//test:fail:group
type Group struct {
Name string
Users []string
Comment string
}
//sections:defaults,backend
//name:hash-type
//test:ok:hash-type map-based
//test:ok:hash-type map-based avalanche
//test:ok:hash-type consistent
//test:ok:hash-type consistent avalanche
//test:ok:hash-type avalanche
//test:ok:hash-type map-based sdbm
//test:ok:hash-type map-based djb2
//test:ok:hash-type map-based wt6
//test:ok:hash-type map-based crc32
//test:ok:hash-type consistent sdbm
//test:ok:hash-type consistent djb2
//test:ok:hash-type consistent wt6
//test:ok:hash-type consistent crc32
//test:ok:hash-type map-based sdbm avalanche
//test:ok:hash-type map-based djb2 avalanche
//test:ok:hash-type map-based wt6 avalanche
//test:ok:hash-type map-based crc32 avalanche
//test:ok:hash-type consistent sdbm avalanche
//test:ok:hash-type consistent djb2 avalanche
//test:ok:hash-type consistent wt6 avalanche
//test:ok:hash-type consistent crc32 avalanche
//test:ok:hash-type consistent none
//test:fail:hash-type
type HashType struct {
Method string
Function string
Modifier string
Comment string
}
//sections:defaults,backend
//name:http-reuse
//test:ok:http-reuse never
//test:ok:http-reuse safe
//test:ok:http-reuse aggressive
//test:ok:http-reuse always
//test:fail:http-reuse sometimes
type HTTPReuse struct {
ShareType string
Comment string
}
//deprecated:true
//sections:defaults,backend
//name:http-check
//is:multiple
//test:ok:http-check disable-on-404
//test:ok:http-check send-state
//test:ok:http-check expect status 200
//test:ok:http-check expect ! string SQL\\ Error
//test:ok:http-check expect ! rstatus ^5
//test:ok:http-check expect rstring <!--tag:[0-9a-f]*--></html>
//test:fail:http-check
type HTTPCheckV2 struct {
Type string
ExclamationMark bool
Match string
Pattern string
Comment string
}
//sections:defaults,frontend,backend
//name:log
//is:multiple
//no:init
//no:parse
//test:ok:log global
//test:ok:no log
//test:ok:log stdout format short daemon # send log to systemd
//test:ok:log stdout format raw daemon # send everything to stdout
//test:ok:log stderr format raw daemon notice # send important events to stderr
//test:ok:log 127.0.0.1:514 local0 notice # only send important events
//test:ok:log 127.0.0.1:514 local0 notice notice # same but limit output level
//test:ok:log 127.0.0.1:1515 len 8192 format rfc5424 local2 info
//test:ok:log 127.0.0.1:1515 sample 1:2 local0
//test:ok:log 127.0.0.1:1515 len 8192 format rfc5424 sample 1,2-5:6 local2 info
//test:ok:log 127.0.0.1:1515 format rfc5424 sample 1,2-5:6 local2 info
//test:ok:log 127.0.0.1:1515 format rfc5424 sample 1-5:6 local2
//test:ok:log 127.0.0.1:1515 sample 1:6 local2
//test:fail:log
//test:fail:log 0 len 0
//test:fail:log 127.0.0.1:1515 len foo format rfc5424 local2 info
//test:fail:log 127.0.0.1:1515 sample test local2
//test:fail:log 127.0.0.1:1515 sample :3 local2
//test:fail:log 127.0.0.1:1515 sample 1:test local2
//test:fail:log sample 1:1
type Log struct {
Global bool
NoLog bool
Address string
Length int64
Format string
SampleRange string
SampleSize int64
Facility string
Level string
MinLevel string
Comment string
}
//sections:mailers
//name:mailer
//is:multiple
//test:ok:mailer smtp1 192.168.0.1:587
//test:ok:mailer smtp1 192.168.0.1:587 # just some comment
//test:fail:mailer
//test:fail:mailer 0
type Mailer struct {
Name string
IP string
Port int64
Comment string
}
//sections:frontend,backend
//name:option forwardfor
//no:parse
//test:ok:option forwardfor
//test:ok:option forwardfor except A
//test:ok:option forwardfor except A header B
//test:ok:option forwardfor except A header B if-none
//test:ok:option forwardfor # comment
//test:ok:option forwardfor except A # comment
//test:fail:option forwardfor except
//test:fail:option forwardfor except A header
//test:fail:option forwardfor header
type OptionForwardFor struct {
Except string
Header string
IfNone bool
Comment string
}
//sections:defaults,backend
//name:option httpchk
//no:parse
//test:ok:option httpchk OPTIONS * HTTP/1.1\\r\\nHost:\\ www
//test:ok:option httpchk <uri>
//test:ok:option httpchk <method> <uri>
//test:ok:option httpchk <method> <uri> <version>
type OptionHttpchk struct {
NoOption bool
Method string
URI string
Version string
Comment string
}
//sections:frontend
//name:option httplog
//no:parse
//test:ok:option httplog
//test:ok:no option httplog
//test:ok:option httplog clf
//test:ok:option httplog # comment
//test:ok:option httplog clf # comment
type OptionHTTPLog struct {
NoOption bool
Clf bool
Comment string
}
//sections:backend
//name:option mysql-check
//no:parse
//test:ok:option mysql-check
//test:ok:option mysql-check user john
//test:ok:option mysql-check user john post-41
//test:ok:option mysql-check user john pre-41
//test:ok:option mysql-check # comment
//test:fail:option mysql-check user
//test:fail:option mysql-check user john 41
//test:fail:option mysql-check user # comment
type OptionMysqlCheck struct {
NoOption bool
User string
ClientVersion string
Comment string
}
//sections:backend
//name:option pgsql-check
//no:parse
//test:ok:option pgsql-check user john
//test:ok:option pgsql-check user john # comment
//test:fail:option pgsql-check
//test:fail:option pgsql-check # comment
//test:fail:option pgsql-check user
//test:fail:option pgsql-check user # comment
type OptionPgsqlCheck struct {
NoOption bool
User string
Comment string
}
//sections:backend
//name:option redispatch
//no:parse
//test:ok:option redispatch
//test:ok:no option redispatch
//test:ok:option redispatch 1
//test:ok:option redispatch # comment
//test:ok:option redispatch -1 # comment
type OptionRedispatch struct {
NoOption bool
Interval *int64
Comment string
}
//sections:backend
//name:option smtpchk
//no:parse
//test:ok:option smtpchk
//test:ok:no option smtpchk
//test:ok:option smtpchk HELO mydomain.org
//test:ok:option smtpchk EHLO mydomain.org
//test:ok:option smtpchk # comment
//test:ok:option smtpchk HELO mydomain.org # comment
type OptionSmtpchk struct {
NoOption bool
Hello string
Domain string
Comment string
}
//sections:backend
//name:external-check path
//no:parse
//test:ok:external-check path /usr/bin:/bin
type ExternalCheckPath struct {
Path string
Comment string
}
//sections:backend
//name:external-check command
//no:parse
//test:ok:external-check command /bin/true
type ExternalCheckCommand struct {
Command string
Comment string
}
//sections:peers
//name:peer
//is:multiple
//test:ok:peer name 127.0.0.1:8080
//test:ok:peer name 127.0.0.1:8080 shard 1
//test:fail:peer name 127.0.0.1
//test:fail:peer name :8080
//test:fail:peer
//test:fail:peer 0
type Peer struct {
Name string
IP string
Port int64
Shard string
Comment string
}
//sections:backend
//name:server
//is:multiple
//test:ok:server name 127.0.0.1:8080
//test:ok:server name 127.0.0.1
//test:ok:server addr 127.0.0.1
//test:ok:server addr ::1
//test:fail:server addr
//test:ok:server name 127.0.0.1 agent-check
//test:ok:server name 127.0.0.1 agent-send name
//test:ok:server name 127.0.0.1 agent-inter 1000ms
//test:ok:server name 127.0.0.1 agent-addr 127.0.0.1
//test:ok:server name 127.0.0.1 agent-addr site.com
//test:ok:server name 127.0.0.1 agent-port 1
//test:ok:server name 127.0.0.1 agent-port 65535
//test:ok:server name 127.0.0.1 allow-0rtt
//test:ok:server name 127.0.0.1 alpn h2
//test:ok:server name 127.0.0.1 alpn http/1.1
//test:ok:server name 127.0.0.1 alpn h2,http/1.1
//test:ok:server name 127.0.0.1 backup
//test:ok:server name 127.0.0.1 ca-file cert.crt
//test:ok:server name 127.0.0.1 check
//test:ok:server name 127.0.0.1 check-send-proxy
//test:ok:server name 127.0.0.1 check-alpn http/1.0
//test:ok:server name 127.0.0.1 check-alpn http/1.1,http/1.0
//test:ok:server name 127.0.0.1 check-proto h2
//test:ok:server name 127.0.0.1 check-ssl
//test:ok:server name 127.0.0.1 check-via-socks4
//test:ok:server name 127.0.0.1 ciphers ECDHE-RSA-AES128-GCM-SHA256
//test:ok:server name 127.0.0.1 ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
//test:ok:server name 127.0.0.1 ciphersuites ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
//test:ok:server name 127.0.0.1 cookie value
//test:ok:server name 127.0.0.1 crl-file file.pem
//test:ok:server name 127.0.0.1 crt cert.pem
//test:ok:server name 127.0.0.1 disabled
//test:ok:server name 127.0.0.1 enabled
//test:ok:server name 127.0.0.1 error-limit 50
//test:ok:server name 127.0.0.1 fall 30
//test:ok:server name 127.0.0.1 force-sslv3
//test:ok:server name 127.0.0.1 force-tlsv10
//test:ok:server name 127.0.0.1 force-tlsv11
//test:ok:server name 127.0.0.1 force-tlsv12
//test:ok:server name 127.0.0.1 force-tlsv13
//test:ok:server name 127.0.0.1 init-addr last,libc,none
//test:ok:server name 127.0.0.1 init-addr last,libc,none,127.0.0.1
//test:ok:server name 127.0.0.1 inter 1500ms
//test:ok:server name 127.0.0.1 fastinter 2500ms
//test:ok:server name 127.0.0.1 fastinter unknown
//test:ok:server name 127.0.0.1 downinter 3500ms
//test:ok:server name 127.0.0.1 log-proto legacy
//test:ok:server name 127.0.0.1 log-proto octet-count
//test:ok:server name 127.0.0.1 maxconn 1
//test:ok:server name 127.0.0.1 maxconn 50
//test:ok:server name 127.0.0.1 maxqueue 0
//test:ok:server name 127.0.0.1 maxqueue 1000
//test:ok:server name 127.0.0.1 max-reuse -1
//test:ok:server name 127.0.0.1 max-reuse 0
//test:ok:server name 127.0.0.1 max-reuse 1
//test:ok:server name 127.0.0.1 minconn 1
//test:ok:server name 127.0.0.1 minconn 50
//test:ok:server name 127.0.0.1 namespace test
//test:ok:server name 127.0.0.1 no-agent-check
//test:ok:server name 127.0.0.1 no-backup
//test:ok:server name 127.0.0.1 no-check
//test:ok:server name 127.0.0.1 no-check-ssl
//test:ok:server name 127.0.0.1 no-send-proxy-v2
//test:ok:server name 127.0.0.1 no-send-proxy-v2-ssl
//test:ok:server name 127.0.0.1 no-send-proxy-v2-ssl-cn
//test:ok:server name 127.0.0.1 no-ssl
//test:ok:server name 127.0.0.1 no-ssl-reuse
//test:ok:server name 127.0.0.1 no-sslv3
//test:ok:server name 127.0.0.1 no-tls-tickets
//test:ok:server name 127.0.0.1 no-tlsv10
//test:ok:server name 127.0.0.1 no-tlsv11
//test:ok:server name 127.0.0.1 no-tlsv12
//test:ok:server name 127.0.0.1 no-tlsv13
//test:ok:server name 127.0.0.1 no-verifyhost
//test:ok:server name 127.0.0.1 no-tfo
//test:ok:server name 127.0.0.1 non-stick
//test:ok:server name 127.0.0.1 npn http/1.1,http/1.0
//test:ok:server name 127.0.0.1 observe layer4
//test:ok:server name 127.0.0.1 observe layer7
//test:ok:server name 127.0.0.1 on-error fastinter
//test:ok:server name 127.0.0.1 on-error fail-check
//test:ok:server name 127.0.0.1 on-error sudden-death
//test:ok:server name 127.0.0.1 on-error mark-down
//test:ok:server name 127.0.0.1 on-marked-down shutdown-sessions
//test:ok:server name 127.0.0.1 on-marked-up shutdown-backup-session
//test:ok:server name 127.0.0.1 pool-max-conn -1
//test:ok:server name 127.0.0.1 pool-max-conn 0
//test:ok:server name 127.0.0.1 pool-max-conn 100
//test:ok:server name 127.0.0.1 pool-purge-delay 0
//test:ok:server name 127.0.0.1 pool-purge-delay 5
//test:ok:server name 127.0.0.1 pool-purge-delay 500
//test:ok:server name 127.0.0.1 port 27015
//test:ok:server name 127.0.0.1 port 27016
//test:ok:server name 127.0.0.1 proto h2