Skip to content

Commit

Permalink
MEDIUM: add new server/bind options
Browse files Browse the repository at this point in the history
Added:

server   pool-conn-name +1
server   hash-key +1
bind  ssl default-crt +1
  • Loading branch information
hdurand0710 committed Jun 24, 2024
1 parent 359262a commit eb3d3b1
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 13 deletions.
10 changes: 10 additions & 0 deletions configuration/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ func parseBindParams(bindOptions []params.BindOption) (b models.BindParams) { //
b.CrtIgnoreErr = v.Value
case "crt-list":
b.CrtList = v.Value
case "default-crt":
if b.DefaultCrtList == nil {
b.DefaultCrtList = []string{}
}
b.DefaultCrtList = append(b.DefaultCrtList, v.Value)
case "gid":
gid, err := strconv.ParseInt(v.Value, 10, 64)
if err == nil {
Expand Down Expand Up @@ -485,6 +490,11 @@ func serializeBindParams(b models.BindParams, path string) (options []params.Bin
if b.CrtList != "" {
options = append(options, &params.BindOptionValue{Name: "crt-list", Value: b.CrtList})
}
if b.DefaultCrtList != nil {
for _, dc := range b.DefaultCrtList {
options = append(options, &params.BindOptionValue{Name: "default-crt", Value: dc})
}
}
if b.DeferAccept {
options = append(options, &params.BindOptionWord{Name: "defer-accept"})
}
Expand Down
10 changes: 10 additions & 0 deletions configuration/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ func parseServerParams(serverOptions []params.ServerOption, serverParams *models
}
case "ws":
serverParams.Ws = v.Value
case "pool-conn-name":
serverParams.PoolConnName = v.Value
case "hash-key":
serverParams.HashKey = v.Value
}
case *params.ServerOptionIDValue:
if v.Name == "set-proxy-v2-tlv-fmt" {
Expand Down Expand Up @@ -837,6 +841,12 @@ func serializeServerParams(s models.ServerParams) (options []params.ServerOption
if s.Ws != "" {
options = append(options, &params.ServerOptionValue{Name: "ws", Value: s.Ws})
}
if s.PoolConnName != "" {
options = append(options, &params.ServerOptionValue{Name: "pool-conn-name", Value: s.PoolConnName})
}
if s.HashKey != "" {
options = append(options, &params.ServerOptionValue{Name: "hash-key", Value: s.HashKey})
}
return options
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/google/go-cmp v0.6.0
github.com/google/renameio v1.0.1
github.com/google/uuid v1.6.0
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240619192607-9ef3696c6fec
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240624075631-c75eaad880c2
github.com/json-iterator/go v1.1.12
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/mitchellh/mapstructure v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU
github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240619192607-9ef3696c6fec h1:3tOw7lSODKXfZa+kZA+lCpmoucV9qrme0cIOX6dvLtc=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240619192607-9ef3696c6fec/go.mod h1:uzi0JXWJYW31M1AzGsczaJtEaoG54qP0LX8B1A2iQRw=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240624075631-c75eaad880c2 h1:sdgelGYw2i16OL47z2bYEiwjuH7KDWC4P9WLQ0BFZd0=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240624075631-c75eaad880c2/go.mod h1:uzi0JXWJYW31M1AzGsczaJtEaoG54qP0LX8B1A2iQRw=
github.com/haproxytech/go-logger v1.1.0 h1:HgGtYaI1ApkvbQdsm7f9AzQQoxTB7w37criTflh7IQE=
github.com/haproxytech/go-logger v1.1.0/go.mod h1:OekUd8HCb7ubxMplzHUPBTHNxZmddOWfOjWclZsqIeM=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down
24 changes: 24 additions & 0 deletions models/bind_params.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 28 additions & 2 deletions models/bind_params_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions models/bind_params_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions models/server_params.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions models/server_params_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions models/server_params_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions specification/build/haproxy_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ definitions:
x-dependency:
ssl:
value: true
default_crt_list:
items:
pattern: ^[^\s]+$
type: string
type: array
x-omitempty: true
defer_accept:
type: boolean
ecdhe:
Expand Down Expand Up @@ -618,6 +624,9 @@ definitions:
guid:
pattern: ^[A-Za-z0-9-_.:]+$
type: string
hash_key:
pattern: ^[^\s]+$
type: string
health_check_address:
pattern: ^[^\s]+$
type: string
Expand Down Expand Up @@ -720,6 +729,9 @@ definitions:
enum:
- shutdown-backup-sessions
type: string
pool_conn_name:
pattern: ^[^\s]+$
type: string
pool_low_conn:
type: integer
x-nullable: true
Expand Down
6 changes: 6 additions & 0 deletions specification/models/configuration/bind_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ bind_params:
x-dependency:
ssl:
value: true
default_crt_list:
type: array
x-omitempty: true
items:
type: string
pattern: '^[^\s]+$'
defer_accept:
type: boolean
expose_fd_listeners:
Expand Down
Loading

0 comments on commit eb3d3b1

Please sign in to comment.