Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit b7f6fa2

Browse files
committed
MEDIUM: quic: add quic related keywords to global and bind
1 parent 7804511 commit b7f6fa2

12 files changed

+302
-0
lines changed

params/bind-options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func getBindOptions() []BindOption {
142142
&BindOptionWord{Name: "transparent"},
143143
&BindOptionWord{Name: "v4v6"},
144144
&BindOptionWord{Name: "v6only"},
145+
&BindOptionWord{Name: "quic-force-retry"},
145146

146147
&BindOptionDoubleWord{Name: "expose-fd", Value: "listeners"},
147148

@@ -183,6 +184,7 @@ func getBindOptions() []BindOption {
183184
&BindOptionValue{Name: "uid"},
184185
&BindOptionValue{Name: "user"},
185186
&BindOptionValue{Name: "verify"},
187+
&BindOptionValue{Name: "quic-cc-algo"},
186188
}
187189
}
188190

parsers/quic-socket-owner.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
Copyright 2023 HAProxy Technologies
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+
http://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+
17+
package parsers
18+
19+
import (
20+
"fmt"
21+
22+
"github.com/haproxytech/config-parser/v4/common"
23+
"github.com/haproxytech/config-parser/v4/errors"
24+
"github.com/haproxytech/config-parser/v4/types"
25+
)
26+
27+
type QuicSocketOwner struct {
28+
data *types.QuicSocketOwner
29+
preComments []string
30+
}
31+
32+
func (p *QuicSocketOwner) Parse(line string, parts []string, comment string) (string, error) {
33+
if len(parts) == 2 && parts[0] == "tune.quic.socket-owner" {
34+
p.data = &types.QuicSocketOwner{}
35+
switch parts[1] {
36+
case "connection", "listener":
37+
p.data.Owner = parts[1]
38+
default:
39+
return "", &errors.ParseError{Parser: "tune.quic.socket-owner", Line: line}
40+
}
41+
return "", nil
42+
}
43+
return "", &errors.ParseError{Parser: "tune.quic.socket-owner", Line: line}
44+
}
45+
46+
func (p *QuicSocketOwner) Result() ([]common.ReturnResultLine, error) {
47+
if p.data == nil || len(p.data.Owner) == 0 {
48+
return nil, errors.ErrFetch
49+
}
50+
data := fmt.Sprintf("tune.quic.socket-owner %s", p.data.Owner)
51+
return []common.ReturnResultLine{
52+
{
53+
Data: data,
54+
},
55+
}, nil
56+
}

parsers/tune.quic.socket-owner_generated.go

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

section-parsers.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ func (p *configParser) getGlobalParser() *Parsers {
289289
addParser(parser, &sequence, &simple.Size{Name: "tune.vars.reqres-max-size"})
290290
addParser(parser, &sequence, &simple.Size{Name: "tune.vars.sess-max-size"})
291291
addParser(parser, &sequence, &simple.Size{Name: "tune.vars.txn-max-size"})
292+
addParser(parser, &sequence, &simple.Number{Name: "tune.quic.frontend.conn-tx-buffers.limit"})
293+
addParser(parser, &sequence, &simple.Time{Name: "tune.quic.frontend.max-idle-timeout"})
294+
addParser(parser, &sequence, &simple.Number{Name: "tune.quic.frontend.max-streams-bidi"})
295+
addParser(parser, &sequence, &simple.Number{Name: "tune.quic.max-frame-loss"})
296+
addParser(parser, &sequence, &simple.Number{Name: "tune.quic.retry-threshold"})
297+
addParser(parser, &sequence, &parsers.QuicSocketOwner{})
298+
addParser(parser, &sequence, &simple.Enabled{Name: "no-quic"})
299+
addParser(parser, &sequence, &simple.Word{Name: "cluster-secret"})
292300
addParser(parser, &sequence, &simple.Number{Name: "tune.zlib.memlevel"})
293301
addParser(parser, &sequence, &simple.Number{Name: "tune.zlib.windowsize"})
294302
addParser(parser, &sequence, &simple.String{Name: "ssl-default-bind-options"})

tests/bind_generated_test.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/configs/haproxy_generated.cfg.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/frontend_data_test.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/frontend_test.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/global_data_test.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/global_test.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)