vz icon indicating copy to clipboard operation
vz copied to clipboard

Add `func (v *VirtioNetworkDeviceConfiguration) GetMACAddress() string`?

Open cfergeau opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

https://developer.apple.com/documentation/virtualization/vznetworkdeviceconfiguration/3656653-macaddress?language=objc

The default value of this property is a random, locally administered, unicast address.

(I assume this is the same behaviour as calling NewRandomLocallyAdministeredMACAddress() explicitly)

I could not find a way to get the value of this default address

Describe the solution you'd like

This address is useful to know on the host as "/var/db/dhcpd_leases" can be parsed to do MAC address -> IP address look ups. And the property is readwrite ( https://developer.apple.com/documentation/virtualization/vznetworkdeviceconfiguration/3656653-macaddress?language=objc ) so a getter in the go API would be nice to have

Describe alternatives you've considered

I'm suggesting this to make the API nicer, but it's easy to workaround with NewRandomLocallyAdministeredMACAddress()

cfergeau avatar Aug 22 '23 10:08 cfergeau

@cfergeau I support APIs at the same level.

https://pkg.go.dev/github.com/Code-Hex/vz/v3#MACAddress.String

However, VirtioNetworkDeviceConfiguration not return MACAddress struct, So I think it better to support GetMACAddress() *MACAddress

Code-Hex avatar Oct 09 '23 04:10 Code-Hex