punchnet-macos/punchnet/Core/PunchnetConfig.swift
2025-08-03 22:20:24 +08:00

31 lines
617 B
Swift

//
// Config.swift
// punchnet
//
// Created by on 2025/5/14.
//
import Foundation
enum PunchnetError: Error {
case dnsUnreachable
}
struct PunchnetConfig {
static let server = "punchnet.aioe.tech"
static let port = 18083
static func getOptions() throws -> [String:NSObject] {
var options: [String: NSObject] = [:]
if let ip = DNSResolver.resolveAddrInfos(PunchnetConfig.server).first {
options["super_ip"] = ip as NSObject
} else {
throw PunchnetError.dnsUnreachable
}
return options
}
}