remove invalid IP rule

This commit is contained in:
True Zhuanjia
2024-09-02 22:46:24 +08:00
parent dcdfbc7394
commit d2a1add105
4 changed files with 2 additions and 23 deletions
-1
View File
@@ -27,6 +27,5 @@
- (void) pauseDiscoveryForHost:(TemporaryHost *)host;
- (void) resumeDiscoveryForHost:(TemporaryHost *)host;
- (void) discoverHost:(NSString*)hostAddress withCallback:(void (^)(TemporaryHost*, NSString*))callback;
+ (void) setBackdoorHostAddress: (NSString*)address;
@end
-11
View File
@@ -21,8 +21,6 @@
#include <sys/socket.h>
#include <netdb.h>
static NSString* backdoorHostAddress;
@implementation DiscoveryManager {
NSMutableArray* _hostQueue;
NSMutableSet* _pausedHosts;
@@ -117,11 +115,6 @@ static NSString* backdoorHostAddress;
//BOOL ret = NO;
freeaddrinfo(result);
NSLog(@"backDoorHostAddress: %@", backdoorHostAddress);
if(ret){
if([address isEqualToString:backdoorHostAddress]) ret = NO;
}
backdoorHostAddress = nil;
NSLog(@"IP Check, is prohibited: %d", ret);
return NO;
@@ -130,10 +123,6 @@ static NSString* backdoorHostAddress;
//#endif
}
+ (void)setBackdoorHostAddress: (NSString* )address{
backdoorHostAddress = address;
}
- (ServerInfoResponse*) getServerInfoResponseForAddress:(NSString*)address {
HttpManager* hMan = [[HttpManager alloc] initWithAddress:address httpsPort:0 serverCert:nil];
ServerInfoResponse* serverInfoResponse = [[ServerInfoResponse alloc] init];
@@ -579,16 +579,7 @@ static NSMutableSet* hostList;
[alertController addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"] style:UIAlertActionStyleCancel handler:nil]];
[alertController addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
NSString* hostAddress = [((UITextField*)[[alertController textFields] objectAtIndex:0]).text trim];
//handles public IP
NSString *publicIpBackdoor = @"-666";
if ([hostAddress rangeOfString:publicIpBackdoor].location != NSNotFound) {
hostAddress = [hostAddress stringByReplacingOccurrencesOfString:publicIpBackdoor withString:@""];
[DiscoveryManager setBackdoorHostAddress:hostAddress];
} else {
[DiscoveryManager setBackdoorHostAddress:nil];
}
[self showLoadingFrame:^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self->_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){
@@ -733,7 +733,7 @@ const int FrontViewPositionNone = 0xff;
// tested on iOS17. this method does not call back on iOS14, runtime orientation limitation not working for iOS14. Probably depends on iOS16 or higher.
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// Return the supported interface orientations based on the current state
NSLog(@"supportedInterfaceOrientations called back 666");
// NSLog(@"supportedInterfaceOrientations called back 666");
//lock the orientation accordingly after streaming is started
DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings];