import Command from '../common/classes/command'; import { Empty, GlobalOptions, GlobalOptionsWithRequiredFilePath } from '../common/interfaces/common'; import { RouteGetOptions } from './route/get.interfaces'; import { RouteInfo, RouteShowOptions } from './route/show.interfaces'; import { RouteAddOptions } from './route/add.interfaces'; /** * List routes. * The command displays the contents of the routing tables or the route(s) selected by some criteria. * * Warning: Changes to the RPDB made with these commands do not become active immediately. * It is assumed that after a script finishes a batch of updates, it flushes the routing cache with * `ip route flush cache`. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. * * @example * * Import module * ``` * import { route } from 'iproute'; * ``` * * Show routes from all tables * ``` * const routes = await route.show({ * table: RouteRoutingTables.All * }); * ``` */ export declare function show(options?: RouteShowOptions, globalOptions?: GlobalOptions): Promise | RouteInfo[]>; /** * Flush routing tables this command flushes routes selected by some criteria. * * The arguments have the same syntax and semantics as the arguments of `ip route show`, but routing tables are * not listed but purged. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. * * @example * * Import module * ``` * import { route } from 'iproute'; * ``` * * Flush the table cache * ``` * await route.flush({ * table: RouteRoutingTables.Cache * }); * ``` */ export declare function flush(options: RouteShowOptions, globalOptions?: GlobalOptions): Promise>; /** * Save routing table information. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. */ export declare function save(options: RouteShowOptions | undefined, globalOptions: GlobalOptionsWithRequiredFilePath): Promise>; /** * Restore routing table information from a file previously generated by {@link save}. * * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. */ export declare function restore(globalOptions: GlobalOptionsWithRequiredFilePath): Promise>; /** * Get a single route. * * This command gets a single route to a destination and prints its contents exactly as the kernel sees it. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. */ export declare function get(options: RouteGetOptions, globalOptions?: GlobalOptions): Promise | RouteInfo[]>; /** * Add new route. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. * * @example * * Import module * ``` * import { route } from 'iproute'; * ``` * * Unicast type route (the default if not specified) * ``` * await route.add({ * to: '10.0.0.0/24', * via: { * address: '192.168.56.1' * } * }); * ``` * * Multipath route with load balance between devices * ``` * await route.add({ * to: 'default', * scope: AddressScopes.Global, * nexthops: [{ * nexthop: true, * dev: 'ppp0' * }, * { * nexthop: true, * dev: 'ppp1' * }] * }); * ``` * * A NAT route * ``` * await route.add({ * type: RoutingTableTypes.Nat, * to: '10.0.0.0/24', * table: 300, * via: { * address: '192.168.56.1' * } * }); * ``` */ export declare function add(options: RouteAddOptions, globalOptions?: GlobalOptions): Promise>; /** * Delete route. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. * * @example * * Import module * ``` * import { route } from 'iproute'; * ``` * * Delete multipath route with load balance between devices * ``` * await route.del({ * to: 'default', * scope: AddressScopes.Global, * nexthops: [{ * nexthop: true, * dev: 'ppp0' * }, * { * nexthop: true, * dev: 'ppp1' * }] * }); * ``` */ export declare function del(options: RouteAddOptions, globalOptions?: GlobalOptions): Promise>; /** * Change route. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. */ export declare function change(options: RouteAddOptions, globalOptions?: GlobalOptions): Promise>; /** * Append route. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. */ export declare function append(options: RouteAddOptions, globalOptions?: GlobalOptions): Promise>; /** * Change or add new one. * * @param options - Parameters options to be passed down to `ip`. * @param globalOptions - Global parameters options that affects the command execution. * * @throws {@link ParametersError} - Throws when passed parameters are invalid. * @throws {@link CommandError} - Throws when the executed command fails. * * @example * * Import module * ``` * import { route } from 'iproute'; * ``` * * Unicast type route (the default if not specified) * ``` * await route.add({ * to: '10.0.0.0/24', * via: { * address: '192.168.56.1' * } * }); * ``` * * Multipath route with load balance between devices * ``` * await route.add({ * to: 'default', * scope: AddressScopes.Global, * nexthops: [{ * nexthop: true, * dev: 'ppp0' * }, * { * nexthop: true, * dev: 'ppp1' * }] * }); * ``` * * A NAT route * ``` * await route.add({ * type: RoutingTableTypes.Nat, * to: '10.0.0.0/24', * table: 300, * via: { * address: '192.168.56.1' * } * }); * ``` */ export declare function replace(options: RouteAddOptions, globalOptions?: GlobalOptions): Promise>; declare const _default: { show: typeof show; flush: typeof flush; save: typeof save; restore: typeof restore; get: typeof get; add: typeof add; del: typeof del; change: typeof change; append: typeof append; replace: typeof replace; }; export default _default;