rename fromIpAddress -> getNetworkInterface

master
Christian Ulrich 2020-10-10 12:31:18 +02:00
parent 1116d06e82
commit a646815e49
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
2 changed files with 3 additions and 3 deletions

View File

@ -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")

View File

@ -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: