| 1 | package protocol |
| 2 | |
| 3 | const ( |
| 4 | PROTO_UNKNOWN = Proto(0) |
| 5 | BGP = Proto(1) |
| 6 | OSPF = Proto(2) |
| 7 | Kernel = Proto(4) |
| 8 | Static = Proto(8) |
| 9 | Direct = Proto(16) |
| 10 | Babel = Proto(32) |
| 11 | RPKI = Proto(64) |
| 12 | BFD = Proto(128) |
| 13 | ) |
| 14 | |
| 15 | type Proto int |
| 16 | |
| 17 | type Protocol struct { |
| 18 | Name string |
| 19 | Description string |
| 20 | IPVersion string |
| 21 | ImportFilter string |
| 22 | ExportFilter string |
| 23 | Proto Proto |
| 24 | Up int |
| 25 | State string |
| 26 | Imported int64 |
| 27 | Exported int64 |
| 28 | Filtered int64 |
| 29 | Preferred int64 |
| 30 | Uptime int |
| 31 | ImportUpdates RouteChangeCount |
| 32 | ImportWithdraws RouteChangeCount |
| 33 | ExportUpdates RouteChangeCount |
| 34 | ExportWithdraws RouteChangeCount |
| 35 | } |
| 36 | |
| 37 | type RouteChangeCount struct { |
| 38 | Received int64 |
| 39 | Rejected int64 |
| 40 | Filtered int64 |
| 41 | Ignored int64 |
| 42 | Accepted int64 |
| 43 | } |
| 44 | |
| 45 | func NewProtocol(name string, proto Proto, ipVersion string, uptime int) *Protocol { |
| 46 | return &Protocol{Name: name, Proto: proto, IPVersion: ipVersion, Uptime: uptime} |
| 47 | } |