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] Extract ip address directly from interface. #112

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

Conversation

comicchang
Copy link

Directly extract ip address from network interface.

Useful if you:

  1. Has multiply interfaces and ECMP.
  2. Behind nat.

config file:

"method": "netif", // or anything other than "http"
"interface": "ppp0",

@timothymiller timothymiller changed the title extract ip address from netif [feature] extract ip address from netif Feb 15, 2023
@timothymiller timothymiller changed the title [feature] extract ip address from netif [feature] Extract ip address from netif Feb 15, 2023
@timothymiller
Copy link
Owner

timothymiller commented Feb 15, 2023

I just merged your changes. I had to merge a few changes from other PRs. I included you in the commit messages: cb7b180

@timothymiller
Copy link
Owner

Had to revert the PR because netif is not compatible with alpine linux.

Let me know if you have time to investigate a solution for alpine linux that is compatible with your netif solution.

@timothymiller timothymiller reopened this Feb 15, 2023
@comicchang
Copy link
Author

Sure, I'll look into it when I have time.

@comicchang
Copy link
Author

@timothymiller
I can remove the dependency on netifaces and use a pure Python method to get the IP address of a network interface. However, this method only works on Linux and may not work on Windows or macOS. Does this modification meet your expectations?

Signed-off-by: Comic Chang <comicchang@gmail.com>
@comicchang comicchang changed the title [feature] Extract ip address from netif [feature] Extract ip address directly from interface. Feb 19, 2023
@comicchang
Copy link
Author

Hi, I've removed the netifaces dependency, reimplemented in pure python, rebased to the latest master, and tested it.

Please review the commit.

@timothymiller
Copy link
Owner

That sounds like a fine trade off @comicchang since the primary way of running this will be in a Linux container.

@ricky9w
Copy link

ricky9w commented Mar 9, 2023

@comicchang @timothymiller Maybe allowing users to customize the IP query command would be a more flexible solution? This would solve the cross-platform issue and provide greater flexibility.

@comicchang
Copy link
Author

@comicchang @timothymiller Maybe allowing users to customize the IP query command would be a more flexible solution? This would solve the cross-platform issue and provide greater flexibility.

Sounds good to me!
I'll try to implement it this weekend.

@ricky9w
Copy link

ricky9w commented Mar 9, 2023

Another PR to allow running custom script to get IPv4 & 6 address #131

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.

None yet

3 participants