Documentation ¶
Index ¶
- Variables
- func AddrDel(link netlink.Link, addr *netlink.Addr) error
- func AddrReplace(link netlink.Link, addr *netlink.Addr) error
- func CleanIPRules() (err error)
- func DelLinkByName(ifName string) error
- func EnsureAddr(link netlink.Link, expect *netlink.Addr) (bool, error)
- func EnsureAddrWithPrefix(link netlink.Link, ipNetSet *terwayTypes.IPNetSet, prefixRoute bool) (bool, error)
- func EnsureClsActQdsic(link netlink.Link) error
- func EnsureHostNsConfig(ipv4, ipv6 bool) error
- func EnsureIPRule(expected *netlink.Rule) (bool, error)
- func EnsureLinkMTU(link netlink.Link, mtu int) (bool, error)
- func EnsureLinkName(link netlink.Link, name string) (bool, error)
- func EnsureLinkUp(link netlink.Link) (bool, error)
- func EnsureNeigh(neigh *netlink.Neigh) (bool, error)
- func EnsureNetConfSet(ipv4, ipv6 bool) error
- func EnsureRoute(expected *netlink.Route) (bool, error)
- func EnsureVlanUntagger(link netlink.Link) error
- func FindIPRule(rule *netlink.Rule) ([]netlink.Rule, error)
- func FoundRoutes(expected *netlink.Route) ([]netlink.Route, error)
- func GenerateIPv6Sysctl(ifName string, disableRA, enableForward bool) map[string][]string
- func GenericTearDown(netNS ns.NetNS) error
- func GetHostIP(ipv4, ipv6 bool) (*terwayTypes.IPNetSet, error)
- func GetRouteTableID(linkIndex int) int
- func JSONStr(v interface{}) string
- func LinkAdd(link netlink.Link) error
- func LinkDel(link netlink.Link) error
- func LinkSetDown(link netlink.Link) error
- func LinkSetMTU(link netlink.Link, mtu int) error
- func LinkSetName(link netlink.Link, name string) error
- func LinkSetNsFd(link netlink.Link, netNS ns.NetNS) error
- func LinkSetUp(link netlink.Link) error
- func NeighSet(neigh *netlink.Neigh) error
- func NetlinkFamily(ip net.IP) int
- func NewIPNet(ipNet *terwayTypes.IPNetSet) *terwayTypes.IPNetSet
- func NewIPNet1(ipNet *terwayTypes.IPNetSet) []*netlink.Addr
- func NewIPNetToMaxMask(ipNet *terwayTypes.IPNetSet) []*netlink.Addr
- func NewIPNetWithMaxMask(ipNet *net.IPNet) *net.IPNet
- func QdiscReplace(qdisc *netlink.GenericQdisc) error
- func RouteDel(route *netlink.Route) error
- func RouteReplace(route *netlink.Route) error
- func RuleAdd(rule *netlink.Rule) error
- func RuleDel(rule *netlink.Rule) error
- func SetLogDebug()
- func SetupTC(link netlink.Link, bandwidthInBytes uint64) error
- type Locker
- type PodInfoHook
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = func() *logrus.Logger { l := logger.NewDefaultLogger() l.AddHook(Hook) return l }()
var Hook = &PodInfoHook{ExtraInfo: make(map[string]string)}
Hook for log
var Log = DefaultLogger.WithField("subSys", "terway-cni")
Log for default log
Functions ¶
func DelLinkByName ¶
DelLinkByName del by name and ignore if link not present
func EnsureAddr ¶
EnsureAddr ensure only one IP for each family is present on link
func EnsureAddrWithPrefix ¶
func EnsureAddrWithPrefix(link netlink.Link, ipNetSet *terwayTypes.IPNetSet, prefixRoute bool) (bool, error)
EnsureAddrWithPrefix take the ipNet set and ensure only one IP for each family is present on link it will remove other unmatched IPs
func EnsureClsActQdsic ¶
func EnsureHostNsConfig ¶
EnsureHostNsConfig setup host namespace configs
func EnsureLinkMTU ¶
EnsureLinkMTU set link mtu,return changed and err
func EnsureLinkUp ¶
EnsureLinkUp set link up,return changed and err
func EnsureNetConfSet ¶
EnsureNetConfSet will set net config to all link
func EnsureRoute ¶
EnsureRoute will call ip route replace if route is not found
func EnsureVlanUntagger ¶
func FindIPRule ¶
FindIPRule look up ip rules in config
func FoundRoutes ¶
FoundRoutes look up routes
func GenerateIPv6Sysctl ¶
func GenericTearDown ¶
GenericTearDown target to clean all related resource as much as possible
func GetRouteTableID ¶
GetRouteTableID add 1000 to link index to avoid route table conflict
func LinkSetDown ¶
func NetlinkFamily ¶
func NewIPNet ¶
func NewIPNet(ipNet *terwayTypes.IPNetSet) *terwayTypes.IPNetSet
func NewIPNetToMaxMask ¶
func NewIPNetToMaxMask(ipNet *terwayTypes.IPNetSet) []*netlink.Addr
func QdiscReplace ¶
func QdiscReplace(qdisc *netlink.GenericQdisc) error
func RouteReplace ¶
func SetLogDebug ¶
func SetLogDebug()
Types ¶
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
func GrabFileLock ¶
GrabFileLock get file lock with timeout 11seconds
type PodInfoHook ¶
func (*PodInfoHook) AddExtraInfo ¶
func (p *PodInfoHook) AddExtraInfo(k, v string)
func (*PodInfoHook) AddExtraInfos ¶
func (p *PodInfoHook) AddExtraInfos(e map[string]string)
func (*PodInfoHook) Levels ¶
func (p *PodInfoHook) Levels() []logrus.Level