[ADD] add hyper-v vm'ip to name translation #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
[Provide a brief description of the new feature you're adding.]
support hyper-v vm's ipv4 addr to domain name. adn the domain-name format is <-your-vmName->.example.com
Motivation and Context
[Explain why this feature is needed and what problem it solves.]
I meet same problem. 'the ip address of vm inside hyper-v changed everytime when system restart' Inspired by this project. I write a domain-name <---> ip addr translation function
How Has This Been Tested?
[Describe the tests you've run to verify your changes. Provide instructions so we can reproduce.]
Proof of Concept:
there are hyper-v api which you can get vm info(ip addr, vnName, etc..)managed by hyper-v
Get-VM | Where-Object {$_.State -eq 'Running'} | Select-Object-ExpandProperty Name
Get-VMNetworkAdapter -VMName <-put-your-vmName-> | Select-Object -ExpandProperty IPAddresses
This must be run by AdministratorI solve the problem by writing a function to do the same thing
Screenshots (if appropriate):
[Add screenshots to help explain your feature, if applicable.]
No sceenshots but there are logs..
Types of changes
Checklist:
Additional Notes
[Add any additional information that might be helpful for reviewers.]
Additional. I fix a bug of
GetHostIP
func which get gateway addr of wsl, and write a new funcGetHostIPv2
which get result from api directly