GetRouteTable returns the route table which is currently in use.
()
| 779 | |
| 780 | // GetRouteTable returns the route table which is currently in use. |
| 781 | func (s *Stack) GetRouteTable() []tcpip.Route { |
| 782 | s.routeMu.RLock() |
| 783 | defer s.routeMu.RUnlock() |
| 784 | table := make([]tcpip.Route, 0) |
| 785 | for r := s.routeTable.Front(); r != nil; r = r.Next() { |
| 786 | table = append(table, *r) |
| 787 | } |
| 788 | return table |
| 789 | } |
| 790 | |
| 791 | // AddRoute appends a route to the route table. |
| 792 | func (s *Stack) AddRoute(route tcpip.Route) { |