Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Add script method to get ip address #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricky9w
Copy link

@ricky9w ricky9w commented Mar 9, 2023

Allow running custom scripts to get both IPv4 and IPv6 address by Python lib subprocess, and validate the output of custom scripts with lib ipaddress (all Python standard libraries)

Given that there will be three ways to obtain an IP address in the future, I have partially refactored the configuration file format. The new configuration file format is as follows:

"ip": {
    "a": {
      "enabled": true,
      "method": "http", // or "netif" or "script"
      "interface": "eth0", // interface name to get IPv4 address, used in interface mode
      "script": "script_v4.sh" // path to script to get IPv4 address
    },
    "aaaa": {
      "enabled": true,
      "method": "http",
      "interface": "eth0",
      "script": "script_v6.sh"
    }
  }

This is just a tentative configuration file scheme. Personally, I think that although it may seem a bit bulky, it looks clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant