What is exactly the relay endpoint in relay server let relayEndpoint = NWEndpoint.url(URL(string: "https://relay.example.com")!)
Is it the server that is already serving the requests ?
Post
Replies
Boosts
Views
Activity
I am using Relay to connect to nginx server which supports http3 connections for which I get
quic_stream_send_create [C1.1.1.1:5] [24e7c30b6b4eb7ba-0000000000001002e2c0e6cb5099cd86ef1f0f7c] unable to create DATAGRAM flow since the peer did not provide max_datagram_frame_size in transport parameters
[C1.1.1.1:3] Unable to send 1200 early bytes
quic_stream_send_create [C1.1.1.1:5] [24e7c30b6b4eb7ba-0000000000001002e2c0e6cb5099cd86ef1f0f7c] unable to create DATAGRAM flow since the peer did not provide max_datagram_frame_size in transport parameters
This is something very simple I have written :
` let relayURL = URL(string: "https://192.168.64.2:8443")!
let relayEndpoint = NWEndpoint.url(relayURL)
if #available(iOS 17.0, *) {
var tlsOptions = NWProtocolTLS.Options()
let relayServer = ProxyConfiguration.RelayHop(http3RelayEndpoint: relayEndpoint, tlsOptions: NWProtocolTLS.Options = .init())
let relayConfig = ProxyConfiguration(relayHops: [relayServer])
let config = URLSessionConfiguration.default`
config.connectionProxyDictionary = [kCFNetworkProxiesHTTPEnable as AnyHashable: true,
kCFNetworkProxiesHTTPProxy as AnyHashable: "192.168.64.2",
kCFNetworkProxiesHTTPPort as AnyHashable: 8443,
kCFStreamPropertySSLSettings as AnyHashable: sslSettings]
config.proxyConfigurations = [relayConfig]
// Call addCert to add the certificate to the trust store
//addCert(cert: "cert")
// Example usage of the custom session
let session = makeInsecureURLSession(config: config)
let url = URL(string: "https://google.com")! // Example URL
let task = session.dataTask(with: url) { data, response, error in
// Handle response
print("response is \(response)")
if let httpResponse = response as? HTTPURLResponse {
let protocolUsed = httpResponse.url?.scheme ?? "Unknown"
print("Protocol used: \(protocolUsed)")
} else {
print("Response is not an HTTPURLResponse")
}
}
task.resume()