31 lines
617 B
Swift
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
|
|
}
|
|
|
|
}
|
|
|