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

Introduce RouteGetWithOptions that allows to modify the RouteGet #522

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

amitn
Copy link
Contributor

@amitn amitn commented Feb 10, 2020

Add support for VrfName as the RouteGetOptions

Signed-off-by: Amit Nishry amit.nishry@gmail.com

Add support for VrfName as the RouteGetOptions

Signed-off-by: Amit Nishry <amit.nishry@gmail.com>
func (h *Handle) RouteGet(destination net.IP) ([]Route, error) {
// RouteGetWithOptions gets a route to a specific destination from the host system.
// Equivalent to: 'ip route get <> vrf <VrfName>'.
func (h *Handle) RouteGetWithOptions(destination net.IP, options *RouteGetOptions) ([]Route, error) {
Copy link
Collaborator

@aboch aboch Feb 10, 2020

Choose a reason for hiding this comment

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

I am not against this approach, was just thinking that if we add variadic options to existing function instead:

func (h *Handle) RouteGet(destination net.IP, options...RouteOption) ([]Route, error)

then we can avoid adding a new method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

totally forgot that it is an option, too much C

@aboch
Copy link
Collaborator

aboch commented Jun 3, 2020

Having an explicit method for querying a route with options is not that bad either.

LGTM

@aboch aboch merged commit 5a869a7 into vishvananda:master Jun 3, 2020
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