Add C Swift Bindings
This adds C Swift bindings for burrow via compiling burrow with a matching header file.
This commit is contained in:
parent
d821f3d03c
commit
3ef13b09a3
4 changed files with 85 additions and 4 deletions
|
|
@ -1,7 +1,22 @@
|
|||
import libburrow
|
||||
import NetworkExtension
|
||||
import OSLog
|
||||
|
||||
class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
let logger = Logger(subsystem: "com.hackclub.burrow", category: "General")
|
||||
override func startTunnel(options: [String: NSObject]?, completionHandler: @escaping (Error?) -> Void) {
|
||||
let fild = libburrow.retrieve()
|
||||
if fild == -1 {
|
||||
// Not sure if this is the right way to return an error
|
||||
logger.error("Failed to retrieve file descriptor for burrow.")
|
||||
let err = NSError(
|
||||
domain: "com.hackclub.burrow",
|
||||
code: 1_010,
|
||||
userInfo: [NSLocalizedDescriptionKey: "Failed to find TunInterface"]
|
||||
)
|
||||
completionHandler(err)
|
||||
}
|
||||
logger.info("fd: \(fild)")
|
||||
completionHandler(nil)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue