1package sockaddr 2 3// RouteInterface specifies an interface for obtaining memoized route table and 4// network information from a given OS. 5type RouteInterface interface { 6 // GetDefaultInterfaceName returns the name of the interface that has a 7 // default route or an error and an empty string if a problem was 8 // encountered. 9 GetDefaultInterfaceName() (string, error) 10} 11 12// VisitCommands visits each command used by the platform-specific RouteInfo 13// implementation. 14func (ri routeInfo) VisitCommands(fn func(name string, cmd []string)) { 15 for k, v := range ri.cmds { 16 cmds := append([]string(nil), v...) 17 fn(k, cmds) 18 } 19} 20