本文整理匯總了Golang中github.com/osrg/gobgp/table.Path.Filtered方法的典型用法代碼示例。如果您正苦於以下問題:Golang Path.Filtered方法的具體用法?Golang Path.Filtered怎麽用?Golang Path.Filtered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/osrg/gobgp/table.Path
的用法示例。
在下文中一共展示了Path.Filtered方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ToPathApi
func ToPathApi(path *table.Path) *Path {
nlri := path.GetNlri()
n, _ := nlri.Serialize()
family := uint32(bgp.AfiSafiToRouteFamily(nlri.AFI(), nlri.SAFI()))
pattrs := func(arg []bgp.PathAttributeInterface) [][]byte {
ret := make([][]byte, 0, len(arg))
for _, a := range arg {
aa, _ := a.Serialize()
ret = append(ret, aa)
}
return ret
}(path.GetPathAttrs())
return &Path{
Nlri: n,
Pattrs: pattrs,
Age: path.GetTimestamp().Unix(),
IsWithdraw: path.IsWithdraw,
Validation: int32(path.Validation().ToInt()),
Filtered: path.Filtered("") == table.POLICY_DIRECTION_IN,
Family: family,
SourceAsn: path.GetSource().AS,
SourceId: path.GetSource().ID.String(),
NeighborIp: path.GetSource().Address.String(),
Stale: path.IsStale(),
IsFromExternal: path.IsFromExternal(),
}
}