-
Notifications
You must be signed in to change notification settings - Fork 39
Feature: support get ipvs info #14
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: kwanhur <[email protected]>
ipvs.go
Outdated
|
|
||
| ver := uint(res.version) | ||
| return &Info{ | ||
| Version: &Version{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put the conversion of ver to Version in a separate function so we can add unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version as one attribute of ipvsInfo, we should test it as a whole? like test case TestInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kwanhur I agree with @andrewsykim.
We can test different inputs for the conversion and not rely on the netlink of the test system.
| } | ||
|
|
||
| // parseInfo given a ipvs netlink response this function will respond with a valid info entry, an error otherwise | ||
| func (i *Handle) parseInfo(msg []byte) (*ipvsInfo, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be bound to *Handle?
Signed-off-by: kwanhur <[email protected]>
Signed-off-by: kwanhur <[email protected]>
|
@andrewsykim @cpuguy83 add two api |
fetch ipvs info with API
info := i.GetInfo()fetch version number just call
info.Version.String(), example: 1.2.1fetch connection table size call
info.ConnTableSize, example: 4096 .