Skip to content

Commit 8cbb7c4

Browse files
committed
MINOR: configuration: add support for cc server and bind params
1 parent 23d8132 commit 8cbb7c4

6 files changed

Lines changed: 21 additions & 6 deletions

File tree

config-parser/params/bind-options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ var bindOptionFactoryMethods = map[string]func() BindOption{ //nolint:gochecknog
276276
"ca-sign-file": func() BindOption { return &BindOptionValue{Name: "ca-sign-file"} },
277277
"ca-sign-pass": func() BindOption { return &BindOptionValue{Name: "ca-sign-pass"} },
278278
"ca-verify-file": func() BindOption { return &BindOptionValue{Name: "ca-verify-file"} },
279+
"cc": func() BindOption { return &BindOptionValue{Name: "cc"} },
279280
"ciphers": func() BindOption { return &BindOptionValue{Name: "ciphers"} },
280281
"ciphersuites": func() BindOption { return &BindOptionValue{Name: "ciphersuites"} },
281282
"client-sigalgs": func() BindOption { return &BindOptionValue{Name: "client-sigalgs"} },

config-parser/params/server-options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ var serverOptionFactoryMethods = map[string]func() ServerOption{ //nolint:gochec
242242
"agent-port": func() ServerOption { return &ServerOptionValue{Name: "agent-port"} },
243243
"alpn": func() ServerOption { return &ServerOptionValue{Name: "alpn"} },
244244
"ca-file": func() ServerOption { return &ServerOptionValue{Name: "ca-file"} },
245+
"cc": func() ServerOption { return &ServerOptionValue{Name: "cc"} },
245246
"check-alpn": func() ServerOption { return &ServerOptionValue{Name: "check-alpn"} },
246247
"check-proto": func() ServerOption { return &ServerOptionValue{Name: "check-proto"} },
247248
"check-sni": func() ServerOption { return &ServerOptionValue{Name: "check-sni"} },

configuration/bind.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ func parseBindParams(bindOptions []params.BindOption) (models.BindParams, string
339339
b.CaSignFile = v.Value
340340
case "ca-sign-pass":
341341
b.CaSignPass = v.Value
342+
case "cc":
343+
b.Cc = v.Value
342344
case "ciphers":
343345
b.Ciphers = v.Value
344346
case "ciphersuites":
@@ -533,6 +535,9 @@ func serializeBindParams(b models.BindParams, name string, path string, opt *opt
533535
if b.CaSignPass != "" {
534536
options = append(options, &params.BindOptionValue{Name: "ca-sign-pass", Value: b.CaSignPass})
535537
}
538+
if b.Cc != "" {
539+
options = append(options, &params.BindOptionValue{Name: "cc", Value: b.Cc})
540+
}
536541
if b.Ciphers != "" {
537542
options = append(options, &params.BindOptionValue{Name: "ciphers", Value: b.Ciphers})
538543
}

configuration/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ func parseServerParams(serverOptions []params.ServerOption, serverParams *models
394394
serverParams.Alpn = v.Value
395395
case "ca-file":
396396
serverParams.SslCafile = v.Value
397+
case "cc":
398+
serverParams.Cc = v.Value
397399
case "check-alpn":
398400
serverParams.CheckAlpn = v.Value
399401
case "check-pool-conn-name":
@@ -788,6 +790,9 @@ func SerializeServerParams(s models.ServerParams, opt *options.ConfigurationOpti
788790
if s.SslCafile != "" { // ca-file
789791
options = append(options, &params.ServerOptionValue{Name: "ca-file", Value: s.SslCafile})
790792
}
793+
if s.Cc != "" {
794+
options = append(options, &params.ServerOptionValue{Name: "cc", Value: s.Cc})
795+
}
791796
if s.CheckAlpn != "" {
792797
options = append(options, &params.ServerOptionValue{Name: "check-alpn", Value: s.CheckAlpn})
793798
}

test/configuration_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ frontend test
427427
mode http
428428
backlog 2048
429429
bind 192.168.1.1:80 name webserv thread all sigalgs RSA+SHA256 client-sigalgs ECDSA+SHA256:RSA+SHA256 ca-verify-file ca.pem nice 789 guid-prefix guid-example default-crt foobar.pem.rsa default-crt foobar.pem.ecdsa tcp-md5sig secretpass ktls on
430-
bind 192.168.1.1:8080 name webserv2 thread 1/all force-tlsv10 ssl no-strict-sni tls-tickets
431-
bind 192.168.1.2:8080 name webserv3 thread 1/1 no-tlsv10 strict-sni no-tls-tickets
430+
bind 192.168.1.1:8080 name webserv2 thread 1/all force-tlsv10 ssl no-strict-sni tls-tickets cc reno
431+
bind 192.168.1.2:8080 name webserv3 thread 1/1 no-tlsv10 strict-sni no-tls-tickets cc bbr
432432
bind [2a01:c9c0:a3:8::3]:80 name ipv6 thread 1/1-1 force-sslv3 idle-ping 10000
433433
bind 192.168.1.1:80 name test-quic quic-socket connection thread 1/1
434434
bind 192.168.1.1:80 name testnbcon thread 1/all nbconn 6
@@ -815,7 +815,7 @@ backend test # my comment
815815
use-server webserv if TRUE # my comment
816816
use-server webserv2 unless TRUE
817817
server webserv 192.168.1.1:9200 maxconn 1000 ssl weight 10 inter 2s cookie BLAH slowstart 6000 proxy-v2-options authority,crc32c ws h1 pool-low-conn 128 id 1234 pool-purge-delay 10s tcp-ut 2s curves secp384r1 client-sigalgs ECDSA+SHA256:RSA+SHA256 sigalgs ECDSA+SHA256 no-renegotiate log-bufsize 10 set-proxy-v2-tlv-fmt(0x20) %[fc_pp_tlv(0x20)] init-state fully-up idle-ping 10s check-reuse-pool strict-maxconn tcp-md5sig secretpass sni-auto check-sni-auto ktls on # my comment
818-
server webserv2 192.168.1.1:9300 maxconn 1000 ssl weight 10 inter 2s cookie BLAH slowstart 6000 proxy-v2-options authority,crc32c ws h1 pool-low-conn 128 hash-key akey pool-conn-name apoolconnname no-check-reuse-pool check-pool-conn-name foo renegotiate # {"comment": "my structured comment", "id": "my_random_id_for_server"}
818+
server webserv2 192.168.1.1:9300 maxconn 1000 ssl weight 10 inter 2s cookie BLAH slowstart 6000 proxy-v2-options authority,crc32c ws h1 pool-low-conn 128 hash-key akey pool-conn-name apoolconnname no-check-reuse-pool check-pool-conn-name foo renegotiate cc cubic # {"comment": "my structured comment", "id": "my_random_id_for_server"}
819819
http-request set-dst hdr(x-dst) # my comment
820820
http-request set-dst-port int(4000)
821821
http-request set-uri %[url,regsub(^/metrics/,/,)] if { path_beg /metrics }

test/expected/structured.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,8 @@
11311131
},
11321132
"check-reuse-pool": "disabled",
11331133
"check-pool-conn-name": "foo",
1134-
"renegotiate": "enabled"
1134+
"renegotiate": "enabled",
1135+
"cc": "cubic"
11351136
}
11361137
}
11371138
},
@@ -2910,7 +2911,8 @@
29102911
"tlsv10": "enabled",
29112912
"no_strict_sni": true,
29122913
"force_strict_sni": "disabled",
2913-
"tls_tickets": "enabled"
2914+
"tls_tickets": "enabled",
2915+
"cc": "reno"
29142916
},
29152917
"webserv3": {
29162918
"name": "webserv3",
@@ -2922,7 +2924,8 @@
29222924
"strict_sni": true,
29232925
"force_strict_sni": "enabled",
29242926
"no_tls_tickets": true,
2925-
"tls_tickets": "disabled"
2927+
"tls_tickets": "disabled",
2928+
"cc": "bbr"
29262929
},
29272930
"test-quic-algo": {
29282931
"name": "test-quic-algo",

0 commit comments

Comments
 (0)