Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-netroute
Commits
1afb09c9
Unverified
Commit
1afb09c9
authored
Mar 09, 2020
by
Will Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove syscall dep from windows
parent
ada0e6f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
netroute_windows.go
netroute_windows.go
+4
-6
No files found.
netroute_windows.go
View file @
1afb09c9
...
@@ -11,7 +11,6 @@ import (
...
@@ -11,7 +11,6 @@ import (
"encoding/binary"
"encoding/binary"
"fmt"
"fmt"
"net"
"net"
"syscall"
"unsafe"
"unsafe"
"github.com/google/gopacket/routing"
"github.com/google/gopacket/routing"
...
@@ -21,7 +20,7 @@ import (
...
@@ -21,7 +20,7 @@ import (
)
)
var
(
var
(
modiphlpapi
=
syscall
.
NewLazyDLL
(
"iphlpapi.dll"
)
modiphlpapi
=
windows
.
NewLazyDLL
(
"iphlpapi.dll"
)
procGetBestRoute2
=
modiphlpapi
.
NewProc
(
"GetBestRoute2"
)
procGetBestRoute2
=
modiphlpapi
.
NewProc
(
"GetBestRoute2"
)
)
)
...
@@ -174,17 +173,16 @@ func readSockAddr(buffer []byte, idx int) (*windows.RawSockaddrAny, int, error)
...
@@ -174,17 +173,16 @@ func readSockAddr(buffer []byte, idx int) (*windows.RawSockaddrAny, int, error)
}
}
func
getBestRoute2
(
interfaceLuid
*
NetLUID
,
interfaceIndex
uint32
,
sourceAddress
,
destinationAddress
*
windows
.
RawSockaddrAny
,
addressSortOptions
uint32
,
bestRoute
[]
byte
,
bestSourceAddress
[]
byte
)
(
errcode
error
)
{
func
getBestRoute2
(
interfaceLuid
*
NetLUID
,
interfaceIndex
uint32
,
sourceAddress
,
destinationAddress
*
windows
.
RawSockaddrAny
,
addressSortOptions
uint32
,
bestRoute
[]
byte
,
bestSourceAddress
[]
byte
)
(
errcode
error
)
{
r0
,
_
,
_
:=
syscall
.
Syscall9
(
procGetBestRoute2
.
Addr
(),
7
,
r0
,
_
,
_
:=
procGetBestRoute2
.
Call
(
uintptr
(
unsafe
.
Pointer
(
interfaceLuid
)),
uintptr
(
unsafe
.
Pointer
(
interfaceLuid
)),
uintptr
(
interfaceIndex
),
uintptr
(
interfaceIndex
),
uintptr
(
unsafe
.
Pointer
(
sourceAddress
)),
uintptr
(
unsafe
.
Pointer
(
sourceAddress
)),
uintptr
(
unsafe
.
Pointer
(
destinationAddress
)),
uintptr
(
unsafe
.
Pointer
(
destinationAddress
)),
uintptr
(
addressSortOptions
),
uintptr
(
addressSortOptions
),
uintptr
(
unsafe
.
Pointer
(
&
bestRoute
[
0
])),
uintptr
(
unsafe
.
Pointer
(
&
bestRoute
[
0
])),
uintptr
(
unsafe
.
Pointer
(
&
bestSourceAddress
[
0
])),
uintptr
(
unsafe
.
Pointer
(
&
bestSourceAddress
[
0
])))
0
,
0
)
if
r0
!=
0
{
if
r0
!=
0
{
errcode
=
syscall
.
Errno
(
r0
)
errcode
=
windows
.
Errno
(
r0
)
}
}
return
return
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment