Add CI/CD configuration and API documentation

This commit is contained in:
2026-07-01 21:40:53 +08:00
commit c590135d68
4168 changed files with 740252 additions and 0 deletions
@@ -0,0 +1,40 @@
import Foundation
import Libbox
public class HTTPClient {
private static var userAgent: String {
var userAgent = Variant.applicationName
userAgent += "/"
userAgent += Bundle.main.version
userAgent += " (Build "
userAgent += Bundle.main.versionNumber
userAgent += "; sing-box "
userAgent += LibboxVersion()
userAgent += ")"
return userAgent
}
private let client: any LibboxHTTPClientProtocol
public init() {
client = LibboxNewHTTPClient()!
client.modernTLS()
}
public func getString(_ url: String?) throws -> String {
let request = client.newRequest()!
request.setUserAgent(HTTPClient.userAgent)
try request.setURL(url)
let response = try request.execute()
var error: NSError?
let contentString = response.getContentString(&error)
if let error {
throw error
}
return contentString
}
deinit {
client.close()
}
}