import Command from '../common/classes/command'; import { Empty, GlobalOptions, GlobalOptionsWithRequiredFilePath } from '../common/interfaces/common'; import { RuleAddOptions } from './rule/add.interfaces'; import { RuleInfo, RuleShowOptions } from './rule/show.interfaces'; /** * Insert a new rule. * * 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 { rule } from 'iproute'; * ``` * * Unicast type rule (the default if not specified) * ``` * await rule.add({ * from: '192.203.80.0/24', * table: 300, * preference: 220 * }); * ``` * * NAT type rule * ``` * await rule.add({ * from: '193.233.7.83', * table: 1, * preference: 320, * nat: '192.203.80.144' * }); * ``` */ export declare function add(options: RuleAddOptions, globalOptions?: GlobalOptions): Promise>; /** * Delete a rule. * * @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 { rule } from 'iproute'; * ``` * * Delete the unused default rule * ``` * await rule.del({ * preference: 32767 * }); * ``` */ export declare function del(options: RuleAddOptions, globalOptions?: GlobalOptions): Promise>; /** * Save rule configuration into a file. * * @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(globalOptions: GlobalOptionsWithRequiredFilePath): Promise>; /** * Restore rule configuration 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>; /** * Deletes all rules. * * 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 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 { rule } from 'iproute'; * ``` * * Flush the rules * ``` * await rule.flush(); * ``` */ export declare function flush(globalOptions?: GlobalOptions): Promise>; /** * Shows installed rules. * * @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 { rule } from 'iproute'; * ``` * * Show all rules * ``` * const rules = await rule.show(); * ``` */ export declare function show(options?: RuleShowOptions, globalOptions?: GlobalOptions): Promise | RuleInfo[]>; declare const _default: { add: typeof add; del: typeof del; save: typeof save; restore: typeof restore; flush: typeof flush; show: typeof show; list: typeof show; }; export default _default;