direct.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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,
  53. hosts: {},
  54. realip: false,
  55. ruleset: false,
  56. domains: [
  57. '+local'
  58. ]
  59. },
  60. LAN_WITHOUT_REAL_IP: {
  61. dns: 'system',
  62. hosts: {
  63. '127.0.0.1.sslip.io': ['127.0.0.1'],
  64. '127.atlas.skk.moe': ['127.0.0.1']
  65. },
  66. realip: false,
  67. ruleset: true,
  68. domains: [
  69. // Common Router
  70. // 'zte.home', // ZTE CPE
  71. // 'airbox.home',
  72. // 'bthub.home',
  73. // 'bthomehub.home',
  74. // 'hitronhub.home',
  75. // 'web.setup.home'
  76. // Aruba Router
  77. '$instant.arubanetworks.com',
  78. '$setmeup.arubanetworks.com',
  79. // ASUS router
  80. '$router.asus.com',
  81. '$repeater.asus.com',
  82. 'asusrouter.com',
  83. // NetGear
  84. 'routerlogin.net',
  85. 'routerlogin.com',
  86. // Tenda WiFi
  87. // 'tendawifi.com',
  88. // TP-Link Router
  89. 'tplinkwifi.net',
  90. 'tplogin.cn',
  91. 'tplinkap.net',
  92. 'tplinkmodem.net',
  93. 'tplinkplclogin.net',
  94. 'tplinkrepeater.net',
  95. // UniFi
  96. '+ui.direct',
  97. '$unifi',
  98. // Other Router
  99. // '$router.com',
  100. '+huaweimobilewifi.com',
  101. '+router',
  102. // 'my.router',
  103. // 'samsung.router',
  104. // '$easy.box', // Vodafone EasyBox
  105. '$aterm.me',
  106. '$console.gl-inet.com',
  107. // '$fritz.box',
  108. // '$fritz.repeater',
  109. // '$myfritz.box',
  110. // '$speedport.ip', // Telekom
  111. // '$giga.cube', // Vodafone GigaCube
  112. '$homerouter.cpe', // Huawei LTE CPE
  113. '$mobile.hotspot', // T-Mobile Hotspot
  114. '$ntt.setup',
  115. '$pi.hole',
  116. '+plex.direct',
  117. // 'web.setup'
  118. // AS112
  119. '+home',
  120. '10.in-addr.arpa',
  121. '16.172.in-addr.arpa',
  122. '17.172.in-addr.arpa',
  123. '18.172.in-addr.arpa',
  124. '19.172.in-addr.arpa',
  125. // '2?.172.in-addr.arpa',
  126. '20.172.in-addr.arpa',
  127. '21.172.in-addr.arpa',
  128. '22.172.in-addr.arpa',
  129. '23.172.in-addr.arpa',
  130. '24.172.in-addr.arpa',
  131. '25.172.in-addr.arpa',
  132. '26.172.in-addr.arpa',
  133. '27.172.in-addr.arpa',
  134. '28.172.in-addr.arpa',
  135. '29.172.in-addr.arpa',
  136. '30.172.in-addr.arpa',
  137. '31.172.in-addr.arpa',
  138. '168.192.in-addr.arpa',
  139. '254.169.in-addr.arpa'
  140. ]
  141. },
  142. LAN_WITH_REALIP: {
  143. dns: 'system',
  144. hosts: {
  145. // localhost: ['127.0.0.1']
  146. },
  147. realip: true,
  148. ruleset: true,
  149. domains: [
  150. '+lan',
  151. // By default, all hostnames with the suffix '.local' will be resolved by the system.
  152. // Some app like OrbStack uses mDNS and this TLD (orb.local) via mDNS.
  153. // Surge already handles .local with mDNS properly, we should not map to server:system
  154. // '+local',
  155. '+internal',
  156. // 'amplifi.lan',
  157. // '$localhost',
  158. '+localdomain',
  159. 'home.arpa',
  160. '127.0.0.1.sslip.io',
  161. '127.atlas.skk.moe'
  162. ]
  163. }
  164. } as const satisfies Record<string, DNSMapping>;
  165. export const HOSTS = {
  166. HOSTS: {
  167. // not actually used, only for a placeholder
  168. dns: '',
  169. hosts: {
  170. 'cdn.jsdelivr.net': ['cdn.jsdelivr.net.cdn.cloudflare.net']
  171. },
  172. realip: false,
  173. ruleset: false,
  174. domains: [] as never[]
  175. }
  176. } as const satisfies Record<string, DNSMapping>;