Skip to content

Commit fd6b9e5

Browse files
committed
BUG/MINOR: allow set-src and set-dst in tcp-request connection
1 parent 398247e commit fd6b9e5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

configuration/tcp_request_rule.go

+17
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/haproxytech/config-parser/v5/common"
2727
parser_errors "github.com/haproxytech/config-parser/v5/errors"
2828
"github.com/haproxytech/config-parser/v5/parsers/actions"
29+
http_actions "github.com/haproxytech/config-parser/v5/parsers/http/actions"
2930
tcp_actions "github.com/haproxytech/config-parser/v5/parsers/tcp/actions"
3031
tcp_types "github.com/haproxytech/config-parser/v5/parsers/tcp/types"
3132
"github.com/haproxytech/config-parser/v5/types"
@@ -790,6 +791,22 @@ func SerializeTCPRequestRule(f models.TCPRequestRule) (rule types.TCPType, err e
790791
CondTest: f.CondTest,
791792
},
792793
}, nil
794+
case models.TCPRequestRuleActionSetDashSrc:
795+
return &tcp_types.Connection{
796+
Action: &http_actions.SetSrc{
797+
Expr: common.Expression{Expr: strings.Split(f.Expr, " ")},
798+
Cond: f.Cond,
799+
CondTest: f.CondTest,
800+
},
801+
}, nil
802+
case models.TCPRequestRuleActionSetDashDst:
803+
return &tcp_types.Connection{
804+
Action: &actions.SetDst{
805+
Expr: common.Expression{Expr: strings.Split(f.Expr, " ")},
806+
Cond: f.Cond,
807+
CondTest: f.CondTest,
808+
},
809+
}, nil
793810
}
794811
return nil, NewConfError(ErrValidationError, fmt.Sprintf("unsupported action '%T' in tcp_request_rule", f.Action))
795812
case models.TCPRequestRuleTypeContent:

0 commit comments

Comments
 (0)