aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/driver
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-10-12 11:44:08 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2021-10-12 11:44:08 -0600
commitd0663c3c94ba75a6d11312fd24dfd2713c9b431b (patch)
tree5a968153526b7e898f46405dd09f0a3e97171909 /driver
parentmanager: use newer wireguard-go APIs (diff)
downloadwireguard-windows-d0663c3c94ba75a6d11312fd24dfd2713c9b431b.tar.xz
wireguard-windows-d0663c3c94ba75a6d11312fd24dfd2713c9b431b.zip
global: use unsafe.Add where possible
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'driver')
-rw-r--r--driver/configuration_windows.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/driver/configuration_windows.go b/driver/configuration_windows.go
index 2029c75a..893cab13 100644
--- a/driver/configuration_windows.go
+++ b/driver/configuration_windows.go
@@ -127,7 +127,7 @@ func (wireguard *Adapter) Configuration() (interfaze *Interface, err error) {
// FirstPeer returns the first peer attached to the interface.
func (interfaze *Interface) FirstPeer() *Peer {
- return (*Peer)(unsafe.Pointer(uintptr(unsafe.Pointer(interfaze)) + unsafe.Sizeof(*interfaze)))
+ return (*Peer)(unsafe.Add(unsafe.Pointer(interfaze), unsafe.Sizeof(*interfaze)))
}
// NextPeer returns the subsequent peer of the current one.
@@ -137,12 +137,12 @@ func (peer *Peer) NextPeer() *Peer {
// FirstAllowedIP returns the first allowed IP attached to the peer.
func (peer *Peer) FirstAllowedIP() *AllowedIP {
- return (*AllowedIP)(unsafe.Pointer(uintptr(unsafe.Pointer(peer)) + unsafe.Sizeof(*peer)))
+ return (*AllowedIP)(unsafe.Add(unsafe.Pointer(peer), unsafe.Sizeof(*peer)))
}
// NextAllowedIP returns the subsequent allowed IP of the current one.
func (allowedIP *AllowedIP) NextAllowedIP() *AllowedIP {
- return (*AllowedIP)(unsafe.Pointer(uintptr(unsafe.Pointer(allowedIP)) + unsafe.Sizeof(*allowedIP)))
+ return (*AllowedIP)(unsafe.Add(unsafe.Pointer(allowedIP), unsafe.Sizeof(*allowedIP)))
}
type ConfigBuilder struct {