Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iptables rule builder #5666

Closed

Conversation

hongliangl
Copy link
Contributor

@hongliangl hongliangl commented Nov 3, 2023

This patch provides a simple way to build iptables rules.

This patch provides a simple way to build iptables rules.

Signed-off-by: Hongliang Liu <[email protected]>

type IPTablesRuleBuilder interface {
MatchIPSetSrc(ipset string) IPTablesRuleBuilder
MatchIPSetDst(ipset string) IPTablesRuleBuilder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an empty line after each method to be more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do


"antrea.io/antrea/pkg/apis/controlplane/v1beta2"
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw there are "type Interface interface" in the iptables.go, maybe it can also be moved here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

MatchInputInterface(eth0).
MatchTransProtocol(v1beta2.ProtocolTCP).
MatchDstPort(port8080, nil).
SetComment(`"Accept TCP 8080"`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these double quotes required for the parameter? if yes, can we move it to inside of SetComment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

Copy link
Contributor

@luolanzone luolanzone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you already include these changes in #5658, please close this PR if it's no longer needed.

@hongliangl
Copy link
Contributor Author

Looks like you already include these changes in #5658, please close this PR if it's no longer needed.

OK

@hongliangl hongliangl closed this Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants