Modules
In Egern, a module is a preset configuration segment that allows users to easily enable or disable a specific set of network processing rules. Modules cover a wide range of functions, including rules, URL rewriting, header rewriting, body rewriting, scripts, MITM, and HTTP capturing. Once a module is enabled, its configuration will be merged into Egern's main configuration.
Configuration Details
Field Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the module. |
url | string | Yes | The address of the module file, which can be a local file path or a remote link. |
update_interval | integer | No | Specifies the update interval (in seconds) when the module file is a remote link. The default value is 86400 (one day). |
enabled | boolean | No | Controls whether the module is enabled. If set to true , the module configuration will take effect; if set to false , it will not. The default value is true . |
Using Modules
Creating a Module File
First, you need to create a module file. A module file is a YAML-formatted file that can contain various configuration items supported by Egern. For example, you can define a set of URL rewriting rules or an HTTP request script in the module file.
Referencing a Module File
In the main configuration file (e.g., Egern.yaml
), you can reference a module file as follows:
modules:
- url: "path/to/your/module.yaml"
update_interval: 86400
enabled: true
The url
here can be either a local path to the module file or a remote link. If url
is a remote link, Egern will periodically download updates from this link based on the update_interval
parameter.
Setting the enabled
parameter to true
activates the module and merges its configuration into the main configuration. If you want to temporarily disable the module's configuration, simply set enabled
to false
.