Skip to content

Commit

Permalink
Fixes for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
pokamest committed May 21, 2023
1 parent 9a25457 commit 3900b23
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 1,119 deletions.
2 changes: 0 additions & 2 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ if(IOS)
set(HEADERS ${HEADERS}
${CMAKE_CURRENT_LIST_DIR}/protocols/ios_vpnprotocol.h
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/iosnotificationhandler.h
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/json.h
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/bigint.h
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/bigintipv6addr.h
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/ipaddress.h
Expand All @@ -326,7 +325,6 @@ if(IOS)
set(SOURCES ${SOURCES}
${CMAKE_CURRENT_LIST_DIR}/protocols/ios_vpnprotocol.mm
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/iosnotificationhandler.mm
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/json.cpp
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/iosglue.mm
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/ipaddress.cpp
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/ipaddressrange.cpp
Expand Down
2 changes: 2 additions & 0 deletions client/ios/networkextension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set_target_properties(networkextension PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "AmneziaVPNNetworkExtension"
MACOSX_BUNDLE_GUI_IDENTIFIER "${BUILD_IOS_APP_IDENTIFIER}.network-extension"
MACOSX_BUNDLE_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${APPLE_PROJECT_VERSION}-${CMAKE_PROJECT_VERSION_TWEAK}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${APPLE_PROJECT_VERSION}"

XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${BUILD_IOS_APP_IDENTIFIER}.network-extension"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_SOURCE_DIR}/AmneziaVPNNetworkExtension.entitlements
Expand Down
1 change: 0 additions & 1 deletion client/platforms/ios/ioscontroller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ public class IOSControllerImpl : NSObject {
}

@objc func checkStatus(callback: @escaping (String, String, String) -> Void) {
Logger.global?.log(message: "Check status")
assert(tunnel != nil)

let proto = tunnel!.protocolConfiguration as? NETunnelProviderProtocol
Expand Down
20 changes: 2 additions & 18 deletions client/platforms/ios/iosvpnprotocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public class IOSVpnProtocolImpl : NSObject {
super.init()
Logger.configureGlobal(tagged: "APP", withFilePath: "")

print("Config from caller: \(config)")

vpnBundleID = bundleID;
precondition(!vpnBundleID.isEmpty)

Expand Down Expand Up @@ -525,11 +523,7 @@ public class IOSVpnProtocolImpl : NSObject {
}

@objc func checkStatus(callback: @escaping (String, String, String) -> Void) {
Logger.global?.log(message: "Check status")
// assert(tunnel != nil)
print("check status")
let protoType = (tunnel!.localizedDescription ?? "").toTunnelType
print(protoType);

switch protoType {
case .wireguard:
Expand All @@ -545,7 +539,6 @@ public class IOSVpnProtocolImpl : NSObject {
}

private func checkShadowSocksStatus(callback: @escaping (String, String, String) -> Void) {
Logger.global?.log(message: "Check ShadowSocks")
guard let proto = tunnel?.protocolConfiguration as? NETunnelProviderProtocol else {
callback("", "", "")
return
Expand All @@ -557,11 +550,8 @@ public class IOSVpnProtocolImpl : NSObject {
callback("", "", "")
return
}

print("server IP: \(serverIpv4Gateway)")


let deviceIpv4Address = getWiFiAddress()
print("device IP: \(serverIpv4Gateway)")
if deviceIpv4Address == nil {
callback("", "", "")
return
Expand Down Expand Up @@ -591,7 +581,6 @@ public class IOSVpnProtocolImpl : NSObject {
}

private func checkOVPNStatus(callback: @escaping (String, String, String) -> Void) {
Logger.global?.log(message: "Check OpenVPN")
guard let proto = tunnel?.protocolConfiguration as? NETunnelProviderProtocol else {
callback("", "", "")
return
Expand All @@ -607,13 +596,8 @@ public class IOSVpnProtocolImpl : NSObject {
.splitToArray(separator: "\n", trimmingCharacters: nil)
.first { $0.starts(with: "remote ") }
.splitToArray(separator: " ", trimmingCharacters: nil)[1]

print("server IP: \(serverIpv4Gateway)")




let deviceIpv4Address = getWiFiAddress()
print("device IP: \(deviceIpv4Address)")
if deviceIpv4Address == nil {
callback("", "", "")
return
Expand Down
Loading

0 comments on commit 3900b23

Please sign in to comment.