rename fromIpAddress -> getNetworkInterface
This commit is contained in:
parent
1116d06e82
commit
a646815e49
|
@ -26,7 +26,7 @@ proc getifaddrs(ifap: ptr ptr Ifaddrs): int {.header: "<ifaddrs.h>", importc: "g
|
|||
proc freeifaddrs(ifap: ptr Ifaddrs): void {.header: "<ifaddrs.h>", importc: "freeifaddrs".}
|
||||
proc if_nametoindex(ifname: cstring): cuint {.header: "<net/if.h>", importc: "if_nametoindex".}
|
||||
|
||||
proc fromIpAddress*(address: IpAddress): NetworkInterface =
|
||||
proc getNetworkInterface*(address: IpAddress): NetworkInterface =
|
||||
var interfaces: ptr Ifaddrs
|
||||
if getifaddrs(addr interfaces) != 0:
|
||||
raise newException(NetworkInterfaceError, "getifaddrs failed")
|
||||
|
|
|
@ -96,7 +96,7 @@ proc injectTcpPacket(rawFd: AsyncFD, ipPacket: IpPacket) {.async.} =
|
|||
|
||||
proc captureSeqNumbers(attempt: ConnectAttempt, cb: PunchProgressCb) {.async.} =
|
||||
# FIXME: timeout?
|
||||
let iface = fromIpAddress(attempt.srcIp)
|
||||
let iface = getNetworkInterface(attempt.srcIp)
|
||||
let captureFd = setupEthernetCapturingSocket(iface)
|
||||
var seqNums = newSeq[uint32]()
|
||||
while seqNums.len < attempt.dstPorts.len:
|
||||
|
@ -117,7 +117,7 @@ proc captureSeqNumbers(attempt: ConnectAttempt, cb: PunchProgressCb) {.async.} =
|
|||
await cb(seqNums)
|
||||
|
||||
proc captureAndResendAck(attempt: ConnectAttempt) {.async.} =
|
||||
let iface = fromIpAddress(attempt.srcIp)
|
||||
let iface = getNetworkInterface(attempt.srcIp)
|
||||
let captureFd = setupEthernetCapturingSocket(iface)
|
||||
let injectFd = setupTcpInjectingSocket()
|
||||
block loops:
|
||||
|
|
Loading…
Reference in New Issue