Skip to content

Introduce RouteGetWithOptions that allows to modify the RouteGet#522

Merged
aboch merged 1 commit intovishvananda:masterfrom
amitn:master
Jun 3, 2020
Merged

Introduce RouteGetWithOptions that allows to modify the RouteGet#522
aboch merged 1 commit intovishvananda:masterfrom
amitn:master

Conversation

@amitn
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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