Skip to content

Commit

Permalink
BUG/MINOR: allow set-src and set-dst in tcp-request connection
Browse files Browse the repository at this point in the history
  • Loading branch information
hdurand0710 committed Feb 19, 2024
1 parent dc7f1ea commit da63d45
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions configuration/tcp_request_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/haproxytech/config-parser/v5/common"
parser_errors "github.com/haproxytech/config-parser/v5/errors"
"github.com/haproxytech/config-parser/v5/parsers/actions"
http_actions "github.com/haproxytech/config-parser/v5/parsers/http/actions"
tcp_actions "github.com/haproxytech/config-parser/v5/parsers/tcp/actions"
tcp_types "github.com/haproxytech/config-parser/v5/parsers/tcp/types"
"github.com/haproxytech/config-parser/v5/types"
Expand Down Expand Up @@ -790,6 +791,22 @@ func SerializeTCPRequestRule(f models.TCPRequestRule) (rule types.TCPType, err e
CondTest: f.CondTest,
},
}, nil
case models.TCPRequestRuleActionSetDashSrc:
return &tcp_types.Connection{
Action: &http_actions.SetSrc{
Expr: common.Expression{Expr: strings.Split(f.Expr, " ")},
Cond: f.Cond,
CondTest: f.CondTest,
},
}, nil
case models.TCPRequestRuleActionSetDashDst:
return &tcp_types.Connection{
Action: &actions.SetDst{
Expr: common.Expression{Expr: strings.Split(f.Expr, " ")},
Cond: f.Cond,
CondTest: f.CondTest,
},
}, nil
}
return nil, NewConfError(ErrValidationError, fmt.Sprintf("unsupported action '%T' in tcp_request_rule", f.Action))
case models.TCPRequestRuleTypeContent:
Expand Down

0 comments on commit da63d45

Please sign in to comment.