tehnerd / gnl2go Goto Github PK
View Code? Open in Web Editor NEWgeneric netlink lib in go. (and lib to work with ipvs)
License: BSD 3-Clause "New" or "Revised" License
generic netlink lib in go. (and lib to work with ipvs)
License: BSD 3-Clause "New" or "Revised" License
I like https://github.com/kobolog/gorb and want to use it in our product. Seems like direct routing mode is missing because of gnl2go. So wonder to know if it can be enhanced for this feature.
I use GetPoolForService()
to detect if a Service exist. I expect GetPoolForService()
to return error if Service not exist. However, it return a Service with attribute I passed in, and error as nil.
Does this works as intended, or is a bug?
Hi @kobolog , @tehnerd , thanks for your answers in this gorb issue . I was reviewing all the useful information you gave to me and now I understand a little more how this works.
I reviewed the changes that @tehnerd made in this commit and it seems like it's almost the functionality I was looking for. However, I couldn't make it work: even if I configured the flags, they did not have any effect and the library worked as usual.
The main function I used to test is in this gist but the output is:
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
UDP 192.168.1.22:50100 sh
-> 192.168.1.22:8080 Masq 10 0 0
-> 192.168.1.22:8081 Masq 10 0 0
While if I do it with:
ipvsadm -A -u 192.168.0.2:50100 -s sh -b sh-fallback
ipvsadm -a -u 192.168.0.2:50100 -r 192.168.0.2:40058 -m -w 10
ipvsadm -a -u 192.168.0.2:50100 -r 192.168.0.2:40059 -m -w 10
The output is:
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
UDP 192.168.0.2:50100 sh (sh-fallback)
-> 192.168.0.2:40058 Masq 10 0 0
-> 192.168.0.2:40059 Masq 10 0 0
(Note the sh-fallback flag)
Also in the commit the flags are translated to a binary array but it may be mistranslated from the ipvsadm C.
Should it be IP_VS_SVC_F_SCHED2 = []byte{0, 0, 0, 0, 0, 0, 1, 0} /* scheduler flag 2 */
or
IP_VS_SVC_F_SCHED2 = []byte{0, 0, 0, 0, 0, 0, 0, 10} /* scheduler flag 2 */
?
It would also be interesting to be able to use combinations of the flags such as
IP_VS_SVC_F_SH_FALLBACK_AND_PORT = []byte{0, 0, 0, 0, 0, 0, 0, 18} /* scheduler flag 2 */
As a user, I want to use the API to list services and destinations. Can you please add it? Thanks.
There is no "Flag []byte" field in Service struct, see
type Pool struct {
Service Service
Dests []Dest
}
type Service struct {
Proto uint16
VIP string
Port uint16
Sched string
FWMark uint32
AF uint16
}
Service flags are really useful, could you please kindly add it? I tried to delve into the code, and quickly realized that it's challenging for me to add it since I don't know how to decode netlink response.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.