Refine logging of some configuration
Log about routing entries.
This commit is contained in:
parent
0a80dec3a7
commit
43c70b2673
|
@ -583,18 +583,17 @@ extension TunnelKitProvider {
|
||||||
if sessionConfiguration.randomizeEndpoint ?? false {
|
if sessionConfiguration.randomizeEndpoint ?? false {
|
||||||
log.info("\tRandomize endpoint: true")
|
log.info("\tRandomize endpoint: true")
|
||||||
}
|
}
|
||||||
// FIXME: refine logging of other routing policies
|
|
||||||
if let routingPolicies = sessionConfiguration.routingPolicies {
|
if let routingPolicies = sessionConfiguration.routingPolicies {
|
||||||
log.info("\tDefault gateway: \(routingPolicies.map { $0.rawValue })")
|
log.info("\tGateway: \(routingPolicies.map { $0.rawValue })")
|
||||||
} else {
|
} else {
|
||||||
log.info("\tDefault gateway: no")
|
log.info("\tGateway: not configured")
|
||||||
}
|
}
|
||||||
if let dnsServers = sessionConfiguration.dnsServers, !dnsServers.isEmpty {
|
if let dnsServers = sessionConfiguration.dnsServers, !dnsServers.isEmpty {
|
||||||
log.info("\tDNS: \(dnsServers.maskedDescription)")
|
log.info("\tDNS: \(dnsServers.maskedDescription)")
|
||||||
} else {
|
} else {
|
||||||
log.info("\tDNS: default")
|
log.info("\tDNS: not configured")
|
||||||
}
|
}
|
||||||
if let searchDomain = sessionConfiguration.searchDomain {
|
if let searchDomain = sessionConfiguration.searchDomain, !searchDomain.isEmpty {
|
||||||
log.info("\tSearch domain: \(searchDomain.maskedDescription)")
|
log.info("\tSearch domain: \(searchDomain.maskedDescription)")
|
||||||
}
|
}
|
||||||
if let httpProxy = sessionConfiguration.httpProxy {
|
if let httpProxy = sessionConfiguration.httpProxy {
|
||||||
|
|
|
@ -484,18 +484,21 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
||||||
log.info("\tRemote: \(remoteAddress.maskedDescription)")
|
log.info("\tRemote: \(remoteAddress.maskedDescription)")
|
||||||
log.info("\tIPv4: \(reply.options.ipv4?.description ?? "not configured")")
|
log.info("\tIPv4: \(reply.options.ipv4?.description ?? "not configured")")
|
||||||
log.info("\tIPv6: \(reply.options.ipv6?.description ?? "not configured")")
|
log.info("\tIPv6: \(reply.options.ipv6?.description ?? "not configured")")
|
||||||
// FIXME: refine logging of other routing policies
|
|
||||||
if let routingPolicies = reply.options.routingPolicies {
|
if let routingPolicies = reply.options.routingPolicies {
|
||||||
log.info("\tDefault gateway: \(routingPolicies.map { $0.rawValue })")
|
log.info("\tGateway: \(routingPolicies.map { $0.rawValue })")
|
||||||
} else {
|
} else {
|
||||||
log.info("\tDefault gateway: not configured")
|
log.info("\tGateway: not configured")
|
||||||
}
|
}
|
||||||
if let dnsServers = reply.options.dnsServers, !dnsServers.isEmpty {
|
if let dnsServers = reply.options.dnsServers, !dnsServers.isEmpty {
|
||||||
log.info("\tDNS: \(dnsServers.map { $0.maskedDescription })")
|
log.info("\tDNS: \(dnsServers.map { $0.maskedDescription })")
|
||||||
} else {
|
} else {
|
||||||
log.info("\tDNS: not configured")
|
log.info("\tDNS: not configured")
|
||||||
}
|
}
|
||||||
log.info("\tDomain: \(reply.options.searchDomain?.maskedDescription ?? "not configured")")
|
if let searchDomain = reply.options.searchDomain, !searchDomain.isEmpty {
|
||||||
|
log.info("\tDomain: \(searchDomain.maskedDescription)")
|
||||||
|
} else {
|
||||||
|
log.info("\tDomain: not configured")
|
||||||
|
}
|
||||||
|
|
||||||
if reply.options.httpProxy != nil || reply.options.httpsProxy != nil {
|
if reply.options.httpProxy != nil || reply.options.httpsProxy != nil {
|
||||||
log.info("\tProxy:")
|
log.info("\tProxy:")
|
||||||
|
@ -561,12 +564,14 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
||||||
// route.gatewayAddress = ipv4.defaultGateway
|
// route.gatewayAddress = ipv4.defaultGateway
|
||||||
// routes.append(route)
|
// routes.append(route)
|
||||||
// }
|
// }
|
||||||
|
log.info("Routing.IPv4: Setting default gateway to \(ipv4.defaultGateway.maskedDescription)")
|
||||||
}
|
}
|
||||||
|
|
||||||
for r in ipv4.routes {
|
for r in ipv4.routes {
|
||||||
let ipv4Route = NEIPv4Route(destinationAddress: r.destination, subnetMask: r.mask)
|
let ipv4Route = NEIPv4Route(destinationAddress: r.destination, subnetMask: r.mask)
|
||||||
ipv4Route.gatewayAddress = r.gateway
|
ipv4Route.gatewayAddress = r.gateway
|
||||||
routes.append(ipv4Route)
|
routes.append(ipv4Route)
|
||||||
|
log.info("Routing.IPv4: Adding route \(r.destination.maskedDescription)/\(r.mask) -> \(r.gateway)")
|
||||||
}
|
}
|
||||||
|
|
||||||
ipv4Settings = NEIPv4Settings(addresses: [ipv4.address], subnetMasks: [ipv4.addressMask])
|
ipv4Settings = NEIPv4Settings(addresses: [ipv4.address], subnetMasks: [ipv4.addressMask])
|
||||||
|
@ -588,12 +593,14 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
||||||
// route.gatewayAddress = ipv6.defaultGateway
|
// route.gatewayAddress = ipv6.defaultGateway
|
||||||
// routes.append(route)
|
// routes.append(route)
|
||||||
// }
|
// }
|
||||||
|
log.info("Routing.IPv6: Setting default gateway to \(ipv6.defaultGateway.maskedDescription)")
|
||||||
}
|
}
|
||||||
|
|
||||||
for r in ipv6.routes {
|
for r in ipv6.routes {
|
||||||
let ipv6Route = NEIPv6Route(destinationAddress: r.destination, networkPrefixLength: r.prefixLength as NSNumber)
|
let ipv6Route = NEIPv6Route(destinationAddress: r.destination, networkPrefixLength: r.prefixLength as NSNumber)
|
||||||
ipv6Route.gatewayAddress = r.gateway
|
ipv6Route.gatewayAddress = r.gateway
|
||||||
routes.append(ipv6Route)
|
routes.append(ipv6Route)
|
||||||
|
log.info("Routing.IPv6: Adding route \(r.destination.maskedDescription)/\(r.prefixLength) -> \(r.gateway)")
|
||||||
}
|
}
|
||||||
|
|
||||||
ipv6Settings = NEIPv6Settings(addresses: [ipv6.address], networkPrefixLengths: [ipv6.addressPrefixLength as NSNumber])
|
ipv6Settings = NEIPv6Settings(addresses: [ipv6.address], networkPrefixLengths: [ipv6.addressPrefixLength as NSNumber])
|
||||||
|
@ -637,6 +644,7 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
||||||
proxySettings = NEProxySettings()
|
proxySettings = NEProxySettings()
|
||||||
proxySettings?.httpsServer = httpsProxy.neProxy()
|
proxySettings?.httpsServer = httpsProxy.neProxy()
|
||||||
proxySettings?.httpsEnabled = true
|
proxySettings?.httpsEnabled = true
|
||||||
|
log.info("Routing: Setting HTTPS proxy \(httpsProxy.address.maskedDescription):\(httpsProxy.port)")
|
||||||
}
|
}
|
||||||
if let httpProxy = cfg.sessionConfiguration.httpProxy ?? reply.options.httpProxy {
|
if let httpProxy = cfg.sessionConfiguration.httpProxy ?? reply.options.httpProxy {
|
||||||
if proxySettings == nil {
|
if proxySettings == nil {
|
||||||
|
@ -644,10 +652,15 @@ extension TunnelKitProvider: SessionProxyDelegate {
|
||||||
}
|
}
|
||||||
proxySettings?.httpServer = httpProxy.neProxy()
|
proxySettings?.httpServer = httpProxy.neProxy()
|
||||||
proxySettings?.httpEnabled = true
|
proxySettings?.httpEnabled = true
|
||||||
|
log.info("Routing: Setting HTTP proxy \(httpProxy.address.maskedDescription):\(httpProxy.port)")
|
||||||
}
|
}
|
||||||
|
|
||||||
// only set if there is a proxy (proxySettings set to non-nil above)
|
// only set if there is a proxy (proxySettings set to non-nil above)
|
||||||
proxySettings?.exceptionList = cfg.sessionConfiguration.proxyBypassDomains ?? reply.options.proxyBypassDomains
|
if let bypass = cfg.sessionConfiguration.proxyBypassDomains ?? reply.options.proxyBypassDomains {
|
||||||
|
proxySettings?.exceptionList = bypass
|
||||||
|
log.info("Routing: Setting proxy by-pass list: \(bypass.maskedDescription)")
|
||||||
|
}
|
||||||
|
|
||||||
// block LAN if desired
|
// block LAN if desired
|
||||||
if routingPolicies?.contains(.blockLocal) ?? false {
|
if routingPolicies?.contains(.blockLocal) ?? false {
|
||||||
let table = RoutingTable()
|
let table = RoutingTable()
|
||||||
|
|
Loading…
Reference in New Issue