fix
This commit is contained in:
parent
1e74de12aa
commit
bd10ea9b99
@ -68,7 +68,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
|
||||
Task {
|
||||
do {
|
||||
self.context = SDLContext(provider: self, config: config, rsaCipher: rsaCipher, aesCipher: aesChiper, logger: SDLLogger(level: .warning))
|
||||
self.context = SDLContext(provider: self, config: config, rsaCipher: rsaCipher, aesCipher: aesChiper, logger: SDLLogger(level: .debug))
|
||||
try await self.context?.start()
|
||||
completionHandler(nil)
|
||||
} catch let err {
|
||||
|
||||
@ -29,15 +29,18 @@ struct SystemConfig {
|
||||
guard let superIp = DNSResolver.resolveAddrInfos(superHost).first else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return [
|
||||
let options = [
|
||||
"version:": version as NSObject,
|
||||
"installed_channel": installedChannel as NSObject,
|
||||
"token": token as NSObject,
|
||||
"super_ip": superIp as NSObject,
|
||||
"super_ip": "118.178.229.213" as NSObject,
|
||||
"super_port": superPort as NSObject,
|
||||
"stun_servers": stunServers as NSObject
|
||||
]
|
||||
|
||||
print("options: \(options)")
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ final class UDPNoticeCenterServer: ChannelInboundHandler {
|
||||
public typealias OutboundOut = AddressedEnvelope<ByteBuffer>
|
||||
|
||||
private var group: MultiThreadedEventLoopGroup?
|
||||
private var thread: Thread?
|
||||
private var channel: Channel?
|
||||
|
||||
var messageFlow = PassthroughSubject<NoticeMessage.InboundMessage, Never>()
|
||||
static let shared = UDPNoticeCenterServer()
|
||||
@ -25,22 +25,17 @@ final class UDPNoticeCenterServer: ChannelInboundHandler {
|
||||
}
|
||||
|
||||
func start() {
|
||||
self.thread = Thread {
|
||||
self.group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
|
||||
let bootstrap = DatagramBootstrap(group: self.group!)
|
||||
.channelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
|
||||
.channelInitializer { channel in
|
||||
channel.pipeline.addHandler(self)
|
||||
}
|
||||
|
||||
let channel = try! bootstrap.bind(host: "127.0.0.1", port: 50195).wait()
|
||||
try! channel.closeFuture.wait()
|
||||
}
|
||||
self.thread?.start()
|
||||
self.group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
|
||||
let bootstrap = DatagramBootstrap(group: self.group!)
|
||||
.channelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
|
||||
.channelInitializer { channel in
|
||||
channel.pipeline.addHandler(self)
|
||||
}
|
||||
|
||||
self.channel = try! bootstrap.bind(host: "127.0.0.1", port: 50195).wait()
|
||||
}
|
||||
|
||||
func stop() {
|
||||
self.thread?.cancel()
|
||||
try? self.group?.syncShutdownGracefully()
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user