GDTCOREndpoints.m 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright 2020 Google LLC
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREndpoints.h"
  17. static NSString *const kINTServerURL =
  18. @"https://dummyapiverylong-dummy.dummy.com/dummy/api/very/long";
  19. @implementation GDTCOREndpoints
  20. + (NSDictionary<NSNumber *, NSURL *> *)uploadURLs {
  21. // These strings should be interleaved to construct the real URL. This is just to (hopefully)
  22. // fool github URL scanning bots.
  23. static NSURL *CCTServerURL;
  24. static dispatch_once_t CCTOnceToken;
  25. dispatch_once(&CCTOnceToken, ^{
  26. const char *p1 = "hts/frbslgiggolai.o/0clgbth";
  27. const char *p2 = "tp:/ieaeogn.ogepscmvc/o/ac";
  28. const char URL[54] = {p1[0], p2[0], p1[1], p2[1], p1[2], p2[2], p1[3], p2[3], p1[4],
  29. p2[4], p1[5], p2[5], p1[6], p2[6], p1[7], p2[7], p1[8], p2[8],
  30. p1[9], p2[9], p1[10], p2[10], p1[11], p2[11], p1[12], p2[12], p1[13],
  31. p2[13], p1[14], p2[14], p1[15], p2[15], p1[16], p2[16], p1[17], p2[17],
  32. p1[18], p2[18], p1[19], p2[19], p1[20], p2[20], p1[21], p2[21], p1[22],
  33. p2[22], p1[23], p2[23], p1[24], p2[24], p1[25], p2[25], p1[26], '\0'};
  34. CCTServerURL = [NSURL URLWithString:[NSString stringWithUTF8String:URL]];
  35. });
  36. static NSURL *FLLServerURL;
  37. static dispatch_once_t FLLOnceToken;
  38. dispatch_once(&FLLOnceToken, ^{
  39. const char *p1 = "hts/frbslgigp.ogepscmv/ieo/eaybtho";
  40. const char *p2 = "tp:/ieaeogn-agolai.o/1frlglgc/aclg";
  41. const char URL[69] = {p1[0], p2[0], p1[1], p2[1], p1[2], p2[2], p1[3], p2[3], p1[4],
  42. p2[4], p1[5], p2[5], p1[6], p2[6], p1[7], p2[7], p1[8], p2[8],
  43. p1[9], p2[9], p1[10], p2[10], p1[11], p2[11], p1[12], p2[12], p1[13],
  44. p2[13], p1[14], p2[14], p1[15], p2[15], p1[16], p2[16], p1[17], p2[17],
  45. p1[18], p2[18], p1[19], p2[19], p1[20], p2[20], p1[21], p2[21], p1[22],
  46. p2[22], p1[23], p2[23], p1[24], p2[24], p1[25], p2[25], p1[26], p2[26],
  47. p1[27], p2[27], p1[28], p2[28], p1[29], p2[29], p1[30], p2[30], p1[31],
  48. p2[31], p1[32], p2[32], p1[33], p2[33], '\0'};
  49. FLLServerURL = [NSURL URLWithString:[NSString stringWithUTF8String:URL]];
  50. });
  51. static NSURL *CSHServerURL;
  52. static dispatch_once_t CSHOnceToken;
  53. dispatch_once(&CSHOnceToken, ^{
  54. // These strings should be interleaved to construct the real URL. This is just to (hopefully)
  55. // fool github URL scanning bots.
  56. const char *p1 = "hts/cahyiseot-agolai.o/1frlglgc/aclg";
  57. const char *p2 = "tp:/rsltcrprsp.ogepscmv/ieo/eaybtho";
  58. const char URL[72] = {p1[0], p2[0], p1[1], p2[1], p1[2], p2[2], p1[3], p2[3], p1[4],
  59. p2[4], p1[5], p2[5], p1[6], p2[6], p1[7], p2[7], p1[8], p2[8],
  60. p1[9], p2[9], p1[10], p2[10], p1[11], p2[11], p1[12], p2[12], p1[13],
  61. p2[13], p1[14], p2[14], p1[15], p2[15], p1[16], p2[16], p1[17], p2[17],
  62. p1[18], p2[18], p1[19], p2[19], p1[20], p2[20], p1[21], p2[21], p1[22],
  63. p2[22], p1[23], p2[23], p1[24], p2[24], p1[25], p2[25], p1[26], p2[26],
  64. p1[27], p2[27], p1[28], p2[28], p1[29], p2[29], p1[30], p2[30], p1[31],
  65. p2[31], p1[32], p2[32], p1[33], p2[33], p1[34], p2[34], p1[35], '\0'};
  66. CSHServerURL = [NSURL URLWithString:[NSString stringWithUTF8String:URL]];
  67. });
  68. static NSDictionary<NSNumber *, NSURL *> *uploadURLs;
  69. static dispatch_once_t URLOnceToken;
  70. dispatch_once(&URLOnceToken, ^{
  71. uploadURLs = @{
  72. @(kGDTCORTargetCCT) : CCTServerURL,
  73. @(kGDTCORTargetFLL) : FLLServerURL,
  74. @(kGDTCORTargetCSH) : CSHServerURL,
  75. @(kGDTCORTargetINT) : [NSURL URLWithString:kINTServerURL]
  76. };
  77. });
  78. return uploadURLs;
  79. }
  80. + (nullable NSURL *)uploadURLForTarget:(GDTCORTarget)target {
  81. NSDictionary<NSNumber *, NSURL *> *URLs = [self uploadURLs];
  82. return [URLs objectForKey:@(target)];
  83. }
  84. @end