Documentation ¶
Index ¶
- Variables
- func RulesMatchSrcFWMark(r, p *Rule) bool
- func RulesMatchSrcFWMarkTable(r, p *Rule) bool
- type HandleIface
- type RouteRules
- type Rule
- func (r *Rule) Copy() *Rule
- func (r *Rule) GoToTable(index int) *Rule
- func (r *Rule) LogCxt() *log.Entry
- func (r *Rule) MatchFWMark(fwmark uint32) *Rule
- func (r *Rule) MatchFWMarkWithMask(fwmark, mask uint32) *Rule
- func (r *Rule) MatchSrcAddress(ip net.IPNet) *Rule
- func (r *Rule) NetLinkRule() *netlink.Rule
- func (r *Rule) Not() *Rule
- type RulesMatchFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GetFailed = errors.New("netlink get operation failed") ConnectFailed = errors.New("connect to netlink failed") ListFailed = errors.New("netlink list operation failed") UpdateFailed = errors.New("netlink update operation failed") TableIndexFailed = errors.New("no table index specified") )
Functions ¶
func RulesMatchSrcFWMark ¶
Types ¶
type HandleIface ¶
type RouteRules ¶
type RouteRules struct { IPVersion int // contains filtered or unexported fields }
RouteRules represents set of routing rules with same ip family. The target of those rules are set of routing tables.
func New ¶
func New( ipVersion int, tableIndexSet set.Set[int], updateFunc RulesMatchFunc, removeFunc RulesMatchFunc, netlinkTimeout time.Duration, newNetlinkHandle func() (HandleIface, error), opRecorder logutils.OpRecorder, ) (*RouteRules, error)
func (*RouteRules) Apply ¶
func (r *RouteRules) Apply() error
func (*RouteRules) PrintCurrentRules ¶
func (r *RouteRules) PrintCurrentRules()
func (*RouteRules) QueueResync ¶
func (r *RouteRules) QueueResync()
func (*RouteRules) RemoveRule ¶
func (r *RouteRules) RemoveRule(rule *Rule)
Remove a Rule. Do nothing if Rule not exists depends based on matchForRemove function.
func (*RouteRules) SetRule ¶
func (r *RouteRules) SetRule(rule *Rule)
Set a Rule. Add to activeRules if it does not already exist based on matchForUpdate function.
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
Rule is a wrapper structure around netlink rule. Currently it supports FWMark, Source match and table action.
func FromNetlinkRule ¶
func (*Rule) MatchFWMark ¶
func (*Rule) MatchFWMarkWithMask ¶
func (*Rule) NetLinkRule ¶
type RulesMatchFunc ¶
Functions to check if two rules has same matching condition (and table index to go to).
Click to show internal directories.
Click to hide internal directories.