Skip to content

Commit 30e3f7e

Browse files
committed
Fix doc comments
Signed-off-by: Norio Nomura <[email protected]>
1 parent d5496fc commit 30e3f7e

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

vmnet.go

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
// The status code returning the result of vmnet operations.
21-
// see: https://developer.apple.com/documentation/vmnet/vmnet_return_t?language=objc
21+
// - https://developer.apple.com/documentation/vmnet/vmnet_return_t?language=objc
2222
type VmnetReturn C.uint32_t
2323

2424
const (
@@ -66,8 +66,8 @@ func (e VmnetReturn) Error() string {
6666
}
6767
}
6868

69-
// VmnetMode defines the mode of a vmnet network.
70-
// see: https://developer.apple.com/documentation/vmnet/operating_modes_t?language=objc
69+
// VmnetMode defines the mode of a [VmnetNetwork].
70+
// - https://developer.apple.com/documentation/vmnet/operating_modes_t?language=objc
7171
type VmnetMode uint32
7272

7373
const (
@@ -77,16 +77,15 @@ const (
7777
BridgedMode VmnetMode = C.VMNET_BRIDGED_MODE
7878
)
7979

80-
// VmnetNetworkConfiguration is configuration for a vmnet network.
81-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_create(_:_:)?language=objc
80+
// VmnetNetworkConfiguration is configuration for the [VmnetNetwork].
81+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_create(_:_:)?language=objc
8282
type VmnetNetworkConfiguration struct {
8383
*pointer
8484
}
8585

86-
// NewVmnetNetworkConfiguration creates a new VmnetNetworkConfiguration with mode.
87-
// This is only supported on macOS 26 and newer, error will
88-
// be returned on older versions.
89-
// BridgedMode is not supported by this function.
86+
// NewVmnetNetworkConfiguration creates a new [VmnetNetworkConfiguration] with [VmnetMode].
87+
// This is only supported on macOS 26 and newer, error will be returned on older versions.
88+
// [BridgedMode] is not supported by this function.
9089
func NewVmnetNetworkConfiguration(mode VmnetMode) (*VmnetNetworkConfiguration, error) {
9190
if err := macOSAvailable(26); err != nil {
9291
return nil, err
@@ -108,9 +107,9 @@ func NewVmnetNetworkConfiguration(mode VmnetMode) (*VmnetNetworkConfiguration, e
108107
return config, nil
109108
}
110109

111-
// SetExternalInterface sets the external interface of a vmnet network.
112-
// This is only available to networks of SharedMode.
113-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_external_interface(_:_:)?language=objc
110+
// SetExternalInterface sets the external interface of the [VmnetNetwork].
111+
// This is only available to networks of [SharedMode].
112+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_external_interface(_:_:)?language=objc
114113
func (c *VmnetNetworkConfiguration) SetExternalInterface(ifname string) error {
115114
cIfname := C.CString(ifname)
116115
defer C.free(unsafe.Pointer(cIfname))
@@ -125,40 +124,40 @@ func (c *VmnetNetworkConfiguration) SetExternalInterface(ifname string) error {
125124
return nil
126125
}
127126

128-
// DisableNat44 disables NAT44 on a network.
129-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_nat44(_:)?language=objc
127+
// DisableNat44 disables NAT44 on the [VmnetNetwork].
128+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_nat44(_:)?language=objc
130129
func (c *VmnetNetworkConfiguration) DisableNat44() {
131130
C.VZVmnetNetworkConfiguration_disableNat44(objc.Ptr(c))
132131
}
133132

134-
// DisableNat66 disables NAT66 on a network.
135-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_nat66(_:)?language=objc
133+
// DisableNat66 disables NAT66 on the [VmnetNetwork].
134+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_nat66(_:)?language=objc
136135
func (c *VmnetNetworkConfiguration) DisableNat66() {
137136
C.VZVmnetNetworkConfiguration_disableNat66(objc.Ptr(c))
138137
}
139138

140-
// DisableDhcp disables DHCP server on a network.
141-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_dhcp(_:)?language=objc
139+
// DisableDhcp disables DHCP server on the [VmnetNetwork].
140+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_dhcp(_:)?language=objc
142141
func (c *VmnetNetworkConfiguration) DisableDhcp() {
143142
C.VZVmnetNetworkConfiguration_disableDhcp(objc.Ptr(c))
144143
}
145144

146-
// DisableDnsProxy disables DNS proxy on a network.
147-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_dns_proxy(_:)?language=objc
145+
// DisableDnsProxy disables DNS proxy on the [VmnetNetwork].
146+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_dns_proxy(_:)?language=objc
148147
func (c *VmnetNetworkConfiguration) DisableDnsProxy() {
149148
C.VZVmnetNetworkConfiguration_disableDnsProxy(objc.Ptr(c))
150149
}
151150

152-
// DisableRouterAdvertisement disables router advertisement on a network.
153-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_router_advertisement(_:)?language=objc
151+
// DisableRouterAdvertisement disables router advertisement on the [VmnetNetwork].
152+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_router_advertisement(_:)?language=objc
154153
func (c *VmnetNetworkConfiguration) DisableRouterAdvertisement() {
155154
C.VZVmnetNetworkConfiguration_disableRouterAdvertisement(objc.Ptr(c))
156155
}
157156

158-
// SetIPv4Subnet configures the IPv4 address for a vmnet network.
157+
// SetIPv4Subnet configures the IPv4 address for the [VmnetNetwork].
159158
// Note that the first, second, and last addresses of the range are reserved.
160159
// The second address is reserved for the host, the first and last are not assignable to any node.
161-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_ipv4_subnet(_:_:_:)?language=objc
160+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_ipv4_subnet(_:_:_:)?language=objc
162161
func (c *VmnetNetworkConfiguration) SetIPv4Subnet(subnet netip.Prefix) error {
163162
if !subnet.Addr().Is4() {
164163
return fmt.Errorf("subnet is not ipv4")
@@ -187,8 +186,8 @@ func (c *VmnetNetworkConfiguration) SetIPv4Subnet(subnet netip.Prefix) error {
187186
return nil
188187
}
189188

190-
// SetIPv6Prefix configures the IPv6 prefix for a vmnet network.
191-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_ipv6_prefix(_:_:_:)?language=objc
189+
// SetIPv6Prefix configures the IPv6 prefix for the [VmnetNetwork].
190+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_ipv6_prefix(_:_:_:)?language=objc
192191
func (c *VmnetNetworkConfiguration) SetIPv6Prefix(prefix netip.Prefix) error {
193192
if !prefix.Addr().Is6() {
194193
return fmt.Errorf("prefix is not ipv6")
@@ -209,7 +208,7 @@ func (c *VmnetNetworkConfiguration) SetIPv6Prefix(prefix netip.Prefix) error {
209208
return nil
210209
}
211210

212-
// AddPortForwardingRule configures a port forwarding rule for the vmnet network.
211+
// AddPortForwardingRule configures a port forwarding rule for the [VmnetNetwork].
213212
// These rules will not be able to be removed or queried until network has been started.
214213
// To do that, use `vmnet_interface_remove_ip_forwarding_rule` or
215214
// `vmnet_interface_get_ip_port_forwarding_rules` C API directly.
@@ -220,7 +219,7 @@ func (c *VmnetNetworkConfiguration) SetIPv6Prefix(prefix netip.Prefix) error {
220219
// internalPort is the TCP or UDP port that forwarded traffic should be redirected to.
221220
// externalPort is the TCP or UDP port on the outside network that should be redirected from.
222221
// internalAddress is the IPv4 or IPv6 address of the machine on the internal network that should receive the forwarded traffic.
223-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_add_port_forwarding_rule(_:_:_:_:_:_:)?language=objc
222+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_add_port_forwarding_rule(_:_:_:_:_:_:)?language=objc
224223
func (c *VmnetNetworkConfiguration) AddPortForwardingRule(protocol uint8, addressFamily uint8, internalPort uint16, externalPort uint16, internalAddress netip.Addr) error {
225224
var address unsafe.Pointer
226225
switch addressFamily {
@@ -257,10 +256,10 @@ func (c *VmnetNetworkConfiguration) AddPortForwardingRule(protocol uint8, addres
257256
return nil
258257
}
259258

260-
// AddDhcpReservation configures a new DHCP reservation for the vmnet network.
259+
// AddDhcpReservation configures a new DHCP reservation for the [VmnetNetwork].
261260
// client is the MAC address for which the DHCP address is reserved.
262261
// reservation is the DHCP IPv4 address to be reserved.
263-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_add_dhcp_reservation(_:_:_:)?language=objc
262+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_add_dhcp_reservation(_:_:_:)?language=objc
264263
func (c *VmnetNetworkConfiguration) AddDhcpReservation(client *MACAddress, reservation netip.Addr) error {
265264
if !reservation.Is4() {
266265
return fmt.Errorf("reservation is not ipv4")
@@ -282,8 +281,8 @@ func (c *VmnetNetworkConfiguration) AddDhcpReservation(client *MACAddress, reser
282281
return nil
283282
}
284283

285-
// SetMtu configures the maximum transmission unit (MTU) for the vmnet network.
286-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_mtu(_:_:)?language=objc
284+
// SetMtu configures the maximum transmission unit (MTU) for the [VmnetNetwork].
285+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_set_mtu(_:_:)?language=objc
287286
func (c *VmnetNetworkConfiguration) SetMtu(mtu uint32) error {
288287
status := C.VZVmnetNetworkConfiguration_setMtu(
289288
objc.Ptr(c),
@@ -295,15 +294,14 @@ func (c *VmnetNetworkConfiguration) SetMtu(mtu uint32) error {
295294
return nil
296295
}
297296

298-
// VmnetNetwork represents a vmnet network.
299-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_create(_:_:)?language=objc
297+
// VmnetNetwork represents a [VmnetNetwork].
298+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_create(_:_:)?language=objc
300299
type VmnetNetwork struct {
301300
*pointer
302301
}
303302

304-
// NewVmnetNetwork creates a new VmnetNetwork with config.
305-
// This is only supported on macOS 26 and newer, error will
306-
// be returned on older versions.
303+
// NewVmnetNetwork creates a new [VmnetNetwork] with [VmnetNetworkConfiguration].
304+
// This is only supported on macOS 26 and newer, error will be returned on older versions.
307305
func NewVmnetNetwork(config *VmnetNetworkConfiguration) (*VmnetNetwork, error) {
308306
if err := macOSAvailable(26); err != nil {
309307
return nil, err
@@ -326,10 +324,9 @@ func NewVmnetNetwork(config *VmnetNetworkConfiguration) (*VmnetNetwork, error) {
326324
return network, nil
327325
}
328326

329-
// NewVmnetNetworkWithSerialization creates a new VmnetNetwork from a serialized representation.
330-
// This is only supported on macOS 26 and newer, error will
331-
// be returned on older versions.
332-
// see: https://developer.apple.com/documentation/vmnet/vmnet_network_create_with_serialization(_:_:)?language=objc
327+
// NewVmnetNetworkWithSerialization creates a new [VmnetNetwork] from a serialized representation.
328+
// This is only supported on macOS 26 and newer, error will be returned on older versions.
329+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_create_with_serialization(_:_:)?language=objc
333330
func NewVmnetNetworkWithSerialization(serialization unsafe.Pointer) (*VmnetNetwork, error) {
334331
if err := macOSAvailable(26); err != nil {
335332
return nil, err
@@ -352,7 +349,8 @@ func NewVmnetNetworkWithSerialization(serialization unsafe.Pointer) (*VmnetNetwo
352349
return network, nil
353350
}
354351

355-
// CopySerialization returns a pointer to a serialized representation of the vmnet network.
352+
// CopySerialization returns a serialized copy of [VmnetNetwork] in xpc_object_t as [unsafe.Pointer].
353+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_copy_serialization(_:_:)?language=objc
356354
func (n *VmnetNetwork) CopySerialization() (unsafe.Pointer, error) {
357355
var status VmnetReturn
358356
ptr := C.VZVmnetNetwork_copySerialization(
@@ -365,7 +363,8 @@ func (n *VmnetNetwork) CopySerialization() (unsafe.Pointer, error) {
365363
return ptr, nil
366364
}
367365

368-
// IPv6Prefix returns the IPv6 prefix of the network.
366+
// IPv6Prefix returns the IPv6 prefix of the [VmnetNetwork].
367+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_get_ipv6_prefix(_:_:_:)?language=objc
369368
func (n *VmnetNetwork) IPv6Prefix() (netip.Prefix, error) {
370369
var prefix C.struct_in6_addr
371370
var prefixLen C.uint8_t
@@ -386,7 +385,8 @@ func in6AddrToNetipAddr(a C.struct_in6_addr) netip.Addr {
386385
return netip.AddrFrom16(*p)
387386
}
388387

389-
// IPv4Subnet returns the IPv4 subnet of the network.
388+
// IPv4Subnet returns the IPv4 subnet of the [VmnetNetwork].
389+
// - https://developer.apple.com/documentation/vmnet/vmnet_network_get_ipv4_subnet(_:_:_:)?language=objc
390390
func (n *VmnetNetwork) IPv4Subnet() (subnet netip.Prefix, err error) {
391391
var cSubnet C.struct_in_addr
392392
var cMask C.struct_in_addr

0 commit comments

Comments
 (0)