direct.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. export interface DNSMapping {
  2. hosts: {
  3. [domain: string]: string[]
  4. },
  5. /** which also disallows wildcard */
  6. realip: boolean,
  7. /** should convert to ruleset */
  8. ruleset: boolean,
  9. dns: string | null,
  10. /**
  11. * domain[0]
  12. *
  13. * + subdomain only
  14. * $ domain only exact match
  15. * [none] domain and subdomain
  16. */
  17. domains: string[]
  18. }
  19. export const DIRECTS = {
  20. HOTSPOT_CAPTIVE_PORTAL: {
  21. dns: 'system',
  22. hosts: {},
  23. realip: false,
  24. ruleset: true,
  25. domains: [
  26. 'securelogin.com.cn',
  27. '$captive.apple.com',
  28. '$hotspot.cslwifi.com'
  29. ]
  30. },
  31. SYSTEM: {
  32. dns: 'system',
  33. hosts: {},
  34. realip: true,
  35. ruleset: false,
  36. domains: [
  37. '+m2m',
  38. // '+ts.net', // TailScale Magic DNS
  39. // AdGuard -- needs to be real ip otherwise AdGuard App will not recognize it, mustn't be fake ip
  40. '$injections.adguard.org',
  41. '$local.adguard.org',
  42. // Auto Discovery
  43. '+bogon'
  44. ]
  45. }
  46. } as const satisfies Record<string, DNSMapping>;
  47. export const LAN = {
  48. // By default, all hostnames with the suffix '.local' will be resolved by the system.
  49. // Some app like OrbStack uses mDNS and this TLD (orb.local) via mDNS.
  50. // Surge already handles .local with mDNS properly, we should not map to server:system
  51. LOCAL_SPECIAL: {
  52. dns: null, // disable DNS server for now. In the future we might wannna explicitly specify `server: force-syslib`
  53. hosts: {},
  54. realip: true,
  55. ruleset: false,
  56. domains: [
  57. '+local'
  58. ]
  59. },
  60. LAN_WITHOUT_REAL_IP: {
  61. dns: 'system',
  62. hosts: {},
  63. realip: false,
  64. ruleset: true,
  65. domains: [
  66. // Common Router
  67. // 'zte.home', // ZTE CPE
  68. // 'airbox.home',
  69. // 'bthub.home',
  70. // 'bthomehub.home',
  71. // 'hitronhub.home',
  72. // 'web.setup.home'
  73. // Aruba Router
  74. '$instant.arubanetworks.com',
  75. '$setmeup.arubanetworks.com',
  76. // ASUS router
  77. '$router.asus.com',
  78. '$repeater.asus.com',
  79. 'asusrouter.com',
  80. // NetGear
  81. 'routerlogin.net',
  82. 'routerlogin.com',
  83. // Tenda WiFi
  84. // 'tendawifi.com',
  85. // TP-Link Router
  86. 'tplinkwifi.net',
  87. 'tplogin.cn',
  88. 'tplinkap.net',
  89. 'tplinkmodem.net',
  90. 'tplinkplclogin.net',
  91. 'tplinkrepeater.net',
  92. // UniFi
  93. '+ui.direct',
  94. '$unifi',
  95. // Other Router
  96. // '$router.com',
  97. '+huaweimobilewifi.com',
  98. '+router',
  99. // 'my.router',
  100. // 'samsung.router',
  101. // '$easy.box', // Vodafone EasyBox
  102. '$aterm.me',
  103. '$console.gl-inet.com',
  104. // '$fritz.box',
  105. // '$fritz.repeater',
  106. // '$myfritz.box',
  107. // '$speedport.ip', // Telekom
  108. // '$giga.cube', // Vodafone GigaCube
  109. '$homerouter.cpe', // Huawei LTE CPE
  110. '$mobile.hotspot', // T-Mobile Hotspot
  111. '$ntt.setup',
  112. '$pi.hole',
  113. '+plex.direct',
  114. // 'web.setup'
  115. // AS112
  116. '+home',
  117. '10.in-addr.arpa',
  118. '16.172.in-addr.arpa',
  119. '17.172.in-addr.arpa',
  120. '18.172.in-addr.arpa',
  121. '19.172.in-addr.arpa',
  122. // '2?.172.in-addr.arpa',
  123. '20.172.in-addr.arpa',
  124. '21.172.in-addr.arpa',
  125. '22.172.in-addr.arpa',
  126. '23.172.in-addr.arpa',
  127. '24.172.in-addr.arpa',
  128. '25.172.in-addr.arpa',
  129. '26.172.in-addr.arpa',
  130. '27.172.in-addr.arpa',
  131. '28.172.in-addr.arpa',
  132. '29.172.in-addr.arpa',
  133. '30.172.in-addr.arpa',
  134. '31.172.in-addr.arpa',
  135. '168.192.in-addr.arpa',
  136. '254.169.in-addr.arpa'
  137. ]
  138. },
  139. LAN_WITH_REALIP: {
  140. dns: 'system',
  141. hosts: {},
  142. realip: true,
  143. ruleset: true,
  144. domains: [
  145. '+lan',
  146. // By default, all hostnames with the suffix '.local' will be resolved by the system.
  147. // Some app like OrbStack uses mDNS and this TLD (orb.local) via mDNS.
  148. // Surge already handles .local with mDNS properly, we should not map to server:system
  149. // '+local',
  150. '+internal',
  151. // 'amplifi.lan',
  152. // '$localhost',
  153. '+localdomain',
  154. 'home.arpa'
  155. ]
  156. }
  157. } as const satisfies Record<string, DNSMapping>;
  158. export const HOSTS = {
  159. HOSTS: {
  160. // not actually used, only for a placeholder
  161. dns: '',
  162. hosts: {
  163. 'cdn.jsdelivr.net': ['cdn.jsdelivr.net.cdn.cloudflare.net']
  164. },
  165. realip: false,
  166. ruleset: false,
  167. domains: [] as never[]
  168. }
  169. } as const satisfies Record<string, DNSMapping>;