Skip to content

Commit

Permalink
mobile: Remove unused Swift/C++ interop code
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Beyad <abeyad@google.com>
  • Loading branch information
abeyad committed Apr 16, 2024
1 parent 55c6ba2 commit 3d3106c
Showing 1 changed file with 0 additions and 100 deletions.
100 changes: 0 additions & 100 deletions mobile/library/swift/EngineBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -804,103 +804,3 @@ open class EngineBuilder: NSObject {
return objcDescription
}
}

#if canImport(EnvoyCxxSwiftInterop)
private extension EngineBuilder {
func generateBootstrap() -> Bootstrap {
var cxxBuilder = Envoy.Platform.EngineBuilder()
cxxBuilder.addLogLevel(self.logLevel.toCXX())

cxxBuilder.addConnectTimeoutSeconds(Int32(self.connectTimeoutSeconds))
cxxBuilder.addDnsRefreshSeconds(Int32(self.dnsRefreshSeconds))
cxxBuilder.addDnsFailureRefreshSeconds(Int32(self.dnsFailureRefreshSecondsBase),
Int32(self.dnsFailureRefreshSecondsMax))
cxxBuilder.addDnsQueryTimeoutSeconds(Int32(self.dnsQueryTimeoutSeconds))
cxxBuilder.addDnsMinRefreshSeconds(Int32(self.dnsMinRefreshSeconds))
cxxBuilder.addDnsPreresolveHostnames(self.dnsPreresolveHostnames.toCXX())
cxxBuilder.enableDnsCache(self.enableDNSCache, Int32(self.dnsCacheSaveIntervalSeconds))
#if ENVOY_ENABLE_QUIC
cxxBuilder.enableHttp3(self.enableHttp3)
for (host, port) in self.quicHints {
cxxBuilder.addQuicHint(host.toCXX(), Int32(port))
}
for (suffix) in self.quicCanonicalSuffixes {
cxxBuilder.addQuicCanonicalSuffix(suffix.toCXX())
}
#endif
cxxBuilder.enableGzipDecompression(self.enableGzipDecompression)
cxxBuilder.enableBrotliDecompression(self.enableBrotliDecompression)
cxxBuilder.enableInterfaceBinding(self.enableInterfaceBinding)
cxxBuilder.enableDrainPostDnsRefresh(self.enableDrainPostDnsRefresh)
cxxBuilder.enforceTrustChainVerification(self.enforceTrustChainVerification)
cxxBuilder.setForceAlwaysUsev6(self.forceIPv6)
cxxBuilder.enablePlatformCertificatesValidation(self.enablePlatformCertificateValidation)
cxxBuilder.respectSystemProxySettings(self.respectSystemProxySettings)
cxxBuilder.addH2ConnectionKeepaliveIdleIntervalMilliseconds(
Int32(self.h2ConnectionKeepaliveIdleIntervalMilliseconds)
)
cxxBuilder.addH2ConnectionKeepaliveTimeoutSeconds(
Int32(self.h2ConnectionKeepaliveTimeoutSeconds)
)
cxxBuilder.addMaxConnectionsPerHost(Int32(self.maxConnectionsPerHost))
cxxBuilder.setStreamIdleTimeoutSeconds(Int32(self.streamIdleTimeoutSeconds))
cxxBuilder.setPerTryIdleTimeoutSeconds(Int32(self.perTryIdleTimeoutSeconds))
cxxBuilder.setAppVersion(self.appVersion.toCXX())
cxxBuilder.setAppId(self.appId.toCXX())
cxxBuilder.setDeviceOs("iOS".toCXX())

for (runtimeGuard, value) in self.runtimeGuards {
cxxBuilder.setRuntimeGuard(runtimeGuard.toCXX(), value)
}

for filter in self.nativeFilterChain.reversed() {
cxxBuilder.addNativeFilter(filter.name.toCXX(), filter.typedConfig.toCXX())
}

for filter in self.platformFilterChain.reversed() {
cxxBuilder.addPlatformFilter(filter.filterName.toCXX())
}

if
let nodeRegion = self.nodeRegion,
let nodeZone = self.nodeZone,
let nodeSubZone = self.nodeSubZone
{
cxxBuilder.setNodeLocality(nodeRegion.toCXX(), nodeZone.toCXX(), nodeSubZone.toCXX())
}

if let nodeID = self.nodeID {
cxxBuilder.setNodeId(nodeID.toCXX())
}

generateXds(&cxxBuilder)

return cxxBuilder.generateBootstrap()
}

private func generateXds(_ cxxBuilder: inout Envoy.Platform.EngineBuilder) {
#if ENVOY_MOBILE_XDS
if let xdsBuilder = self.xdsBuilder {
var cxxXdsBuilder = Envoy.Platform.XdsBuilder(xdsBuilder.xdsServerAddress.toCXX(),
xdsBuilder.xdsServerPort)
for (header, value) in xdsBuilder.xdsGrpcInitialMetadata {
cxxXdsBuilder.addInitialStreamHeader(header.toCXX(), value.toCXX())
}
if let xdsSslRootCerts = xdsBuilder.sslRootCerts {
cxxXdsBuilder.setSslRootCerts(xdsSslRootCerts.toCXX())
}
if let rtdsResourceName = xdsBuilder.rtdsResourceName {
cxxXdsBuilder.addRuntimeDiscoveryService(rtdsResourceName.toCXX(),
Int32(xdsBuilder.rtdsTimeoutInSeconds))
}
if xdsBuilder.enableCds {
cxxXdsBuilder.addClusterDiscoveryService(
xdsBuilder.cdsResourcesLocator?.toCXX() ?? "".toCXX(),
Int32(xdsBuilder.cdsTimeoutInSeconds))
}
cxxBuilder.setXds(cxxXdsBuilder)
}
#endif
}
}
#endif

0 comments on commit 3d3106c

Please sign in to comment.