Skip to content

Commit

Permalink
fix: fixed import VLESS links to support grpc and quic protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
tzmax committed Dec 9, 2022
1 parent b598fde commit 09d0e38
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion V2RayX/ConfigImporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ + (ServerProfile*)importFromVLESSOfXray:(NSString*)vlessStr {
newProfile.userId = nilCoalescing([url user], newProfile.userId);

// newProfile.alterId = [nilCoalescing([sharedServer objectForKey:@"aid"], @0) intValue];
NSDictionary *netWorkDict = @{@"tcp": @0, @"kcp": @1, @"ws":@2, @"h2":@3 };
NSDictionary *netWorkDict = @{@"tcp": @0, @"kcp": @1, @"ws":@2, @"http":@3, @"quic":@4, @"grpc":@5 };

if ([sharedServer objectForKey:@"type"] && [netWorkDict objectForKey:[sharedServer objectForKey:@"type"]]) {
newProfile.network = [netWorkDict[sharedServer[@"type"]] intValue];
Expand Down Expand Up @@ -516,6 +516,21 @@ + (ServerProfile*)importFromVLESSOfXray:(NSString*)vlessStr {
}
}
break;
case quic:
streamSettings[@"quicSettings"][@"headerType"] = nilCoalescing([sharedServer objectForKey:@"headerType"], @"");
streamSettings[@"quicSettings"][@"quicSecurity"] = nilCoalescing([sharedServer objectForKey:@"quicSecurity"], @"none");
if ([sharedServer objectForKey:@"quicSecurity"]) {
streamSettings[@"quicSettings"][@"key"] = nilCoalescing([[sharedServer objectForKey:@"key"] stringByRemovingPercentEncoding], @"");
}
break;
case grpc:
streamSettings[@"grpcSettings"][@"serviceName"] = nilCoalescing([sharedServer objectForKey:@"serviceName"], @"");
if ([[sharedServer objectForKey:@"mode"] containsString:@"multi"]) {
streamSettings[@"grpcSettings"][@"multiMode"] = @YES;
} else {
streamSettings[@"grpcSettings"][@"multiMode"] = @NO;
}
break;
default:
break;
}
Expand Down

0 comments on commit 09d0e38

Please sign in to comment.