Fix Swiftlints
This commit is contained in:
parent
669eed0dac
commit
286ecfa590
2 changed files with 15 additions and 15 deletions
|
|
@ -7,10 +7,10 @@ enum BurrowError: Error {
|
|||
case resultIsNone
|
||||
}
|
||||
|
||||
protocol Request: Codable where T: Codable{
|
||||
associatedtype T
|
||||
protocol Request: Codable where CommandT: Codable {
|
||||
associatedtype CommandT
|
||||
var id: UInt { get set }
|
||||
var command: T { get set }
|
||||
var command: CommandT { get set }
|
||||
}
|
||||
|
||||
struct BurrowSingleCommand: Request {
|
||||
|
|
@ -38,7 +38,10 @@ struct BurrowStartRequest: Codable {
|
|||
}
|
||||
|
||||
func start_req_fd(id: UInt) -> BurrowRequest<BurrowStartRequest> {
|
||||
return BurrowRequest(id: id, command: BurrowStartRequest(Start: BurrowStartRequest.StartOptions(tun: BurrowStartRequest.TunOptions(name: nil, no_pi: false, tun_excl: false, tun_retrieve: true, address: nil))))
|
||||
let command = BurrowStartRequest(Start: BurrowStartRequest.StartOptions(
|
||||
tun: BurrowStartRequest.TunOptions(name: nil, no_pi: false, tun_excl: false, tun_retrieve: true, address: nil)
|
||||
))
|
||||
return BurrowRequest(id: id, command: command)
|
||||
}
|
||||
|
||||
struct Response<T>: Decodable where T: Decodable {
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||
|
||||
// let tunFd = self.packetFlow.value(forKeyPath: "socket.fileDescriptor") as! Int;
|
||||
// self.logger.info("Found File Descriptor: \(tunFd)")
|
||||
let start_command = start_req_fd(id: 1)
|
||||
guard let data = try await client?.request(start_command, type: Response<BurrowResult<String>>.self)
|
||||
let startCommand = start_req_fd(id: 1)
|
||||
guard let data = try await client?.request(startCommand, type: Response<BurrowResult<String>>.self)
|
||||
else {
|
||||
throw BurrowError.cantParseResult
|
||||
}
|
||||
let encoded_startres = try JSONEncoder().encode(data.result)
|
||||
self.logger.log("Received start server response: \(String(decoding: encoded_startres, as: UTF8.self))")
|
||||
let encodedStartRes = try JSONEncoder().encode(data.result)
|
||||
self.logger.log("Received start server response: \(String(decoding: encodedStartRes, as: UTF8.self))")
|
||||
} catch {
|
||||
self.logger.error("An error occurred: \(error)")
|
||||
throw error
|
||||
|
|
@ -58,15 +58,12 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||
return nst
|
||||
}
|
||||
override func stopTunnel(with reason: NEProviderStopReason) async {
|
||||
|
||||
}
|
||||
override func handleAppMessage(_ messageData: Data) async -> Data? {
|
||||
messageData
|
||||
}
|
||||
override func sleep() async {
|
||||
|
||||
}
|
||||
override func wake() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue