You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
348 B
Go
19 lines
348 B
Go
package main
|
|
|
|
import (
|
|
"github.com/vishvananda/netlink"
|
|
)
|
|
|
|
type FilterOptions struct {
|
|
Table int
|
|
Protocol int
|
|
}
|
|
|
|
func CheckFilter(options FilterOptions, route netlink.Route) bool {
|
|
if (options.Table != -1 && options.Table != route.Table) ||
|
|
(options.Protocol != -1 && options.Protocol != route.Protocol) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|